找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 2673|回复: 0

[PC&NB] DirectAdmin 更换IP

[复制链接]
发表于 2011-10-5 23:48 | 显示全部楼层 |阅读模式
Steps for changing server ip and creating images.

**** Change server ip ****
Boot the server with the new server ip. (the new one you want to use)
DirectAdmin will not be running, as the license file will be invalid.
Contact DirectAdmin to obtain a new license file. They will change the ip in the license.
Get the new license file:
  1. cd /usr/local/directadmin/scripts
  2. ./getLicense.sh UID LID
复制代码
Where UID and LID are your client ID and your license id.
Ensure the license downloaded properly by making sure the file contains no error messages.
Start DirectAdmin with the new license:
  1. service directadmin restart
复制代码
(The taskq may have already started it, thus the restart instead of just “start”)

Download the ipswap.sh script from directadmin:
  1. wget http://www.directadmin.com/ipswap.sh
  2. chmod 755 ipswap.sh
复制代码
Execute that script with the old and and the new ip. Example:
  1. ./ipswap.sh 1.2.3.4 4.3.2.1
复制代码
where 1.2.3.4 is your old ip and 4.3.2.1 is the new ip.
This script can be run on any ip, so if you want to change all ips with new ones, just run this script for each old ip with the new ip. Just ensure that you match the new server ip with the old one.

Restart everything:

service httpd restart
service proftpd restart
service exim restart
service vm-pop3d restart


Make sure they are correctly binding to the new ports by testing them.

You’ll need to update the users list cache so that you see the new results in the show users lists:

echo “action=cache&value=showallusers” >> /usr/local/directadmin/data/task.queue

That’s it

**** Creating an Image ****

Install whatever additional services you want on the server (if you need up2date, this would be a good time)

Install a default copy of DirectAdmin on a server.
Be sure to install the customapache script.

Delete the license (doesn’t really matter.. just so that nobody else gets a hold of it)

Create the image using whatever method you would like.

*** copy the image to the new server

Run the scripts you would normally run to setup the image properly.
Instead of manually changing the ip through DirectAdmin (as above), you can make a script to change the following files:

/etc/hosts (probably already done from your image script)
/etc/proftpd.conf (change log path)
/etc/proftpd.vhosts.conf (nothing should be needed here.. the file should be empty)
/etc/httpd/conf/httpd.conf (change the 2 vhosts at the bottom of the file)
/etc/httpd/conf/ips.conf (change all old ips to the new one)
/usr/local/directadmin/scripts/setup.txt (just for housecleaning, change the ip and ns’s)
/usr/local/directadmin/data/admin/ip.list (change the ip to the new one)
/usr/local/directadmin/data/admin/ips/1.2.3.4 (change 1.2.3.4 to the new ip, 4.3.2.1)
/usr/local/directadmin/data/users/admin/user.conf (change ip and ns’s)
/usr/local/directadmin/data/users/admin/httpd.conf (shoudn’t have any vhosts, but if it does, change the ip)
/usr/local/directadmin/data/users/admin/reseller.conf (change ns’s)

Server should now be ready for customers.
When you need to use the server, contact DirectAdmin, order a license using the new server’s ip.
Once activated, run:
  1. wget https://www.directadmin.com/cgi-bin/licenseupdate?uid=UID\&lid=LID -O /usr/local/directadmin/conf/license.key
复制代码
Restart DirectAdmin and you should be up and running.[/quote]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

QQ|Archiver|手机版|小黑屋|吹友吧 ( 京ICP备05078561号 )

GMT+8, 2024-12-27 07:25 , Processed in 0.229118 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表