Flavours of Linux
For whatever reason, I have found myself looking after two VPS set-ups: the first running CentOS with South West Broadband, the second an Ubuntu droplet over at Digital Ocean. Thing is, after learning the basics of server configuration, and getting comfortable with the way CentOS does things, I’ve only gone and confused myself by flitting between the variants. Common tasks are carried out in quite different ways.
For instance, CentOS uses yum
as its package manager; Ubuntu has apt-get
. When configuring Apache on CentOS, it is restarted using /etc/init.d/httpd restart
(which I’ve aliased to the slightly snappier reboot
). Back in Ubuntu-land, this operation is done with service apache2 restart
, but don’t forget to activate any new hosts with a2ensite
.
Below is a short table describing the commands I’ve found useful as a website owner:
Task | CentOS | Ubuntu |
---|---|---|
Change password | passwd | |
Add a user | adduser USERNAME | |
Delete a user | userdel USERNAME | |
Remove user directory | rm -rf /home/USERNAME | |
Delete user and their home directory | userdel -r USERNAME | |
Webroot | /var/www | |
Edit virtual hosts | /etc/httpd/conf/httpd.conf | /etc/apache2/sites-available/site-name |
Enable virtual host | N/A | a2ensite site-name |
Reboot Apache | /etc/init.d/httpd restart | service apache2 restart |
Install package | yum install package | apt-get package |
Find IP address | ifconfig eth0 |
PS - Sorry for not using your favourite distro, or for doing things in an incredibly convoluted manner. Feel free to correct me on Twitter with any tips and tricks you’ve picked up!