Set Up Ubuntu 18.04This guide describes how to install and configure commonly used software on Ubuntu 18.04. Install UbuntuDownload and install Ubuntu Server 18.04 or Ubuntu Desktop 18.04. Starting from 18.04.1, Ubuntu Server doesn't include the "Universe" repositories where lots of useful software are hosted. Add them back by: > sudo add-apt-repository universe After installation, run the following commands to update the software packages: > sudo apt update
> sudo apt upgrade
Then install some commonly used tools: > sudo apt install mailutils mutt curl vim nmap git build-essential
During installation, when you are asked to select mail server configuration type, choose "Internet Site". Configure Auto Updateunattended-upgrades should already be installed, but if not, install it first: > sudo apt install unattended-upgrades Edit /etc/apt/apt.conf.d/50unattended-upgrades to enable the following:
Then > sudo service unattended-upgrades restart NginxFor HTTP server I recommend Nginx over Apache as Nginx is not only faster, but for common setups Nginx configuration is also easier. > sudo apt install nginx Please check out Nginx Configuration on how to configure Nginx for various setups. Java, Maven, and TomcatFor Ubuntu Server, install openjdk-11-jdk-headless, and for Ubuntu Desktop, install openjdk-11-jdk, e.g. > sudo apt install openjdk-11-jdk-headless Then install Maven and Tomcat: > sudo apt install maven tomcat8 Node.js and NPM Global PackagesAt the time of writing (i.e. 7/2018), Node.js 10 is not under LTS but will be soon, so we'll install Node.js 10 instead of 8: > curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
> sudo apt install -y nodejs
Using sudo to install NPM global package seems to be discouraged. The NPM documentation recommends using a version manager, but I feel that changing NPM's default directory (the second option in the documentation) is better because it keeps the same command line syntax as on Windows, and it's one less tool to learn or use. So: > mkdir ~/.npm-global
> npm config set prefix '~/.npm-global'
Edit .profile file so the PATH environment variable looks like the following:
then > source ~/.profile And install the following global packages > npm install -g typescript ts-node nodemon @angular/cli pm2 MySQLThere are two versions of MySQL: one distributed with Ubuntu and one distributed by MySQL.com. We'll use the second one as it's more up to date. First download and install the package from MySQL.com that sets up the apt repository: > wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
> sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
> sudo apt update
You will be asked to to choose MySQL server version and other components, and you can simply leave everything to default. Then install MySQL server: > sudo apt install mysql-server After MySQL server is installed, run the following command to create a more secure setup: > sudo mysql_secure_installation You will be asked a number of questions. Here are my suggestions for the answers:
After that you may want to create a non-root user for regular database usage. For example: > mysql -u root -p PostgreSQL> sudo apt-get install postgresql Again, create a regular user: > sudo -u postgres psql template1
psql> create user cysun with createdb password 'abcd';
psql> create database cysun with owner=cysun;
psql> \q
Leave out the createdb option in the CREATE USER statement if you do not want to grant the user the privilege to create databases. MongoDBThere are two versions of MongoDB: one distributed with Ubuntu and one distributed by mongodb.org. We'll use the second one as it's more up to date. > sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
> echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
> sudo apt update
> sudo apt install mongodb-org
After installing the packages, start the mongod service and set the service to autostart after reboot: > sudo service mongod start MongoDB shows a few startup warnings/messages when a mongo client is connected to the server, and these warnings/messages can be a bit annoying for a single-user development setup. You can edit /etc/mongod.conf to disable two of them: security: If you are not using XFS as the file system, there's also a warning about performance, and that warning cannot be disabled in configuration. Subversion> sudo apt-get install subversion xinetd Create /etc/xinetd.d/svn with the following content: service svn then restart xinetd: > sudo /etc/init.d/xinetd restart User Management
|