Show Menu
Cheatography

Ubuntu 18.04 Server Configuration Cheat Sheet by

Common commands and installation basics I need to remember

Ubuntu Server 18.04

apt - Advanced Packaging Tool

Update available packages
sudo apt update
Upgrades all currently installed packages
sudo apt upgrade
Remove packages that are no longer required
sudo apt autoremove

ufw - Uncomp­licated Firewall

1. Install ufw
sudo apt install ufw
2 Setup default policies
sudo ufw default deny incoming
 
sudo ufw default allow outgoing
3. Allow SSH
sudo ufw allow 22
...or
sudo ufw allow ssh
4. Enable ufw
sudo ufw enable
5. Allow other connec­tions
...Apache
sudo ufw allow 'Apache Full'
...Webmin
sudo ufw allow 10000
View current ufw status
sudo ufw status verbose

Install Webmin

1. Edit the sources list
sudo nano /etc/a­pt/­sou­rce­s.list
Add the following line to your sources file
2. Download the Webmin PGP key
3. Install the Webmin PGP key
sudo apt-key add jcamer­on-­key.asc
4. Update packages including the Webmin repository
sudo apt update
5. Install Webmin
sudo apt install webmin
Once the instal­lation finishes, you'll be presented with the following output:
Webmin install complete. You can now login to https:­//y­our­_se­rve­r_i­p:10000 as root with your root password, or as any user who can use
sudo
.
Add port 10000 to your firewall
sudo ufw allow 10000
 

Install Apache 2.4

Install Apache 2.x
sudo  apt install apache2
... or, as a single command
sudo apt update && apt-get install apache2
Enable ports through
ufw
firewall
sudo ufw allow http && ufw allow https
... or, via pre-de­fined app settings
sudo ufw allow 'Apache Full'
Start Apache
sudo apachectl start
Restart Apache after changing settings
sudo apachectl restart
Where is Apache installed
which apache2

Install PHP

1. Install PHP
sudo apt install php libapa­che­2-m­od-php
2. Restart Apache
sudo systemctl restart apache2
Check where PHP is installed
which php
Check PHP version
php -v
Check INI file config­uration
php --ini
Dump PHP config­uration
php --info
Install optional modules
apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mb­string php-xml libapa­che­2-m­od-php
check all the PHP modules available in Ubuntu
apt-cache search --name­s-only ^php

Install MySQL

Install MySQL
sudo apt install mysql-­server
Once the instal­lation is complete, the MySQL server should be started automa­tic­ally.
Check the status of MySQL
sudo netstat -tap | grep mysql
Start the service (if not running)
sudo systemctl restart mysql.s­ervice

Install MongoDB

Install MongoDB package
sudo apt install -y mongod­b-org
Check MongoDB service status
sudo systemctl status mongodb
Start MongoDB
sudo systemctl start mongod.se­rvice
Stop MongoDB
sudo systemctl stop mongod.se­rvice
Restart the MongoDB service
sudo systemctl restart mongodb
Enable automatic service startup
sudo systemctl enable mongod.se­rvice
Disable automatic service startup
sudo systemctl disable mongodb
       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          Ubuntu Unity Cheat Sheet
          Windows Terminal Cheat Sheet

          More Cheat Sheets by doublehelix

          Python Date Time Format (strftime) Cheat Sheet