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:

TaskCentOSUbuntu
Change passwordpasswd
Add a useradduser USERNAME
Delete a useruserdel USERNAME
Remove user directoryrm -rf /home/USERNAME
Delete user and their home directoryuserdel -r USERNAME
Webroot/var/www
Edit virtual hosts/etc/httpd/conf/httpd.conf/etc/apache2/sites-available/site-name
Enable virtual hostN/Aa2ensite site-name
Reboot Apache/etc/init.d/httpd restartservice apache2 restart
Install packageyum install packageapt-get package
Find IP addressifconfig 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!