• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

hostname and serverIP change via command line

izghitu

New Pleskian
Hi,

I have a VPS image of a Plesk install which I use to create new VPS'. Each time a new one is created I need to change its hostname and have it re-read the VPS IP, remove old broken IPs and regenerate apache configs.

How do I change the hostname of plesk/server via command line?
How do I have it re-read the IPs and remove the old ones via command line?

Please help
 
Plesk uses the system hostname, so basically you just change the system hostname with command

hostname <new_hostname>
 
Assuming your server runs Fedora Core or RedHat, you’ll have to make changes in the following locations:

/etc/hosts

Your current hostname should be here behind the server’s IP address, change this to the new hostname

/etc/sysconfig/network

You should have a HOSTNAME variable here, change this to your new hostname.

/var/qmail/control/me

This contains the old hostname, change it to your new hostname to make qmail identify itself as the new hostname.

/etc/httpd/conf/httpd.include

You should have a ServerName variable here, change it to your new hostname.

Change the servers hostname while it’s running, normally this is set at boot.

hostname <newhostname>

Set the new hostname inside Plesk’s database:

mysql -u admin -pcat /etc/psa/.psa.shadow use psa; update misc set val='NEWHOSTNAME' where param='FullHostName';

Now restart Plesk to activate your changes:

/etc/init.d/psa stopall
/etc/init.d/psa stop
/etc/init.d/psa start
 
what about the IP re-read and removal?

# /usr/local/psa/admin/bin/ifmng --help
Usage: ifmng [OPTIONS]...

-l, --list list all addresses in format: "<ipaddr> <netmask> <interface> <is-primary-ip>\n ..."
-a, --add <interface> <ipaddress> <netmask> add IP on <interface>
-d, --del <ipaddress> delete IP
-h, --help display this help and exit
-v, --vz-assigned-ip <ipaddress> determine if <ipaddress> was assigned to this VE
 
Back
Top