How To Install Go on Ubuntu 18.04 LTS

Install Go on Ubuntu 18

Golang is an open source programming language that makes it easy to build simple, reliable, and efficient software. In a nutshell, Go is an elegant language with a clean and concise specifications that are readable and comprehensive. One of the major strengths of Golang is its concurrency, which means multiple process of the Go applications can run at same time.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Go programming language on Ubuntu 18.04 LTS Bionic Beaver server.

Install Go on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Go on Ubuntu 18.04 LTS.

Method 1. Install Go using Golang installer.


wget -q https://storage.googleapis.com/golang/getgo/installer_linux

Make the Golang installation executable:

chmod +x installer_linux

Then, run the installer_linux executable to install Go on your Ubuntu system:

### ./installer_linux 
Welcome to the Go installer!
Downloading Go version go1.10 to /home/linuxconfig/.go
This may take a bit of time...
Downloaded!
Setting up GOPATH
GOPATH has been set up!

One more thing! Run `source /home/wpcademy/.bash_profile` to persist the
new environment variables to your current session, or open a
new shell prompt.

As prompted by installer, run the source command to update your current shell session variables to include the new GOPATH, or simply open a new shell session:

source /home/wpcademy/.bash_profile

You can confirm with the Go version installed:

### go version
go version go1.10 linux/amd64

Method 2. Install Go from Ubuntu repostiory.


apt install golang

Next, we first need to set GOPATH:

echo 'export GOPATH=$HOME/go' >> ~/.bashrc 
echo 'export PATH=${PATH}:${GOPATH}/bin' >> ~/.bashrc 
source ~/.bashrc

Method 3. Install Go using Snap.


snap install go --classic

Next, set GOPATH:

echo 'export GOPATH=$HOME/go' >> ~/.bashrc 
echo 'export PATH=${PATH}:${GOPATH}/bin' >> ~/.bashrc 
source ~/.bashrc

Check for installed version:

### go version
go version go1.10 linux/amd64

Congratulations! You have successfully installed Go. Thanks for using this tutorial for installing Go programming language in Ubuntu 18.04 LTS Bionic Beaver systems. For additional help or useful information, we recommend you to check the official Go programming language web site.

How To Install Nginx on Ubuntu 18.04 LTS

Install Nginx on Ubuntu 18

Nginx is a powerful web server software that can be used on your server. It is also known for its high performance and low memory usage which will allow fewer resources to be used but getting the job done efficiently. A popular set up is to use it as a proxy for Apache, which can then serve application requests.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Nginx on a Ubuntu 18.04 (Bionic Beaver) server.

Install Nginx on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Nginx.

Installing nginx package on Ubuntu 18.04 Bionic Beaver) is as easy as running:

apt-get install nginx

After that, run the commands to enable Nginx to automatically startup when your server starts:

sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

To test Nginx setup, open your browser and browse to the server hostname or IP address and you should see Nginx default test page as shown below:

Nginx-Default-Page-Ubuntu

Step 3. Configure Nginx.

Nginx site-specific configuration files are kept in /etc/nginx/conf.d/. Generally you will want a separate file in this directory for each domain or subdomain you will be hosting.

Copy the default configuration file. Replace wpcademy.com with your website’s domain name or your public IP address.


sudo cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/https://wpcademy.com.conf

Open your site’s configuration file in a nano text editor. Replace example.com in the server_name directive with your site’s domain name or IP address. If you already have content ready to serve (such as a WordPress installation) replace the path in the root directive with the path to your site’s content:


server {
 listen 80;
 server_name wpcademy.com;

#charset koi8-r;
 #access_log /var/log/nginx/host.access.log main;

location / {
 root /usr/share/nginx/html;
 index index.html index.htm;
 }

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
 #
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
 root /usr/share/nginx/html;
 }
}

Test your configuration for errors:

nginx -t

Step 4. Configure the Firewall for Nginx.
Firewall software needs to be adjusted to allow access to the service. Nginx registers itself as a service with ufw upon installation, making it straightforward to allow Nginx access:

sudo ufw allow 'Nginx HTTP'

Congratulations! You have successfully installed Nginx. Thanks for using this tutorial for installing Nginx web server in Ubuntu 18.04 LTS (Bionic Beaver) system. For additional help or useful information, we recommend you to check the official Nginx web site.

How To Install Express.js Web Server on Ubuntu 16.04 LTS

Install Express.js Web Server on Ubuntu 16

Express is a NodeJS web application framework. It provides robust set of features and can be used for building single-page, multi-page as well as hybrid web-based applications.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Express.js Web Server on an Ubuntu 16.04 Xenial Xerus server.

Install Express.js Web Server on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Node.JS.

First, add the Node.JS official repository with the command below:

curl -sL https://deb.nodesource.com/setup_8.x | -E bash -

Install Node.JS using following command:

apt-get install nodejs

Step 3. Installing Express.JS on Ubuntu 16.04 LTS.

Install the Express.JS package, the command is:

npm install express

To make life easier, we will use a neat little module called express-generator, To install Express Generator, simply execute:

npm install -g express-generator

We are going to install “EJS” rendering engine for our project, you can set it up using the following command:

express -v ejs wpcademy

It will create a new directory (wpcademy) in our project. Now you have to switch into it and execute the following command to make sure that you have all of the required modules:

cd wpcademy/
npm install

Now you can start your Express.JS project using the following command:

npm start

Step 4. Accessing Express.JS.

Express.JS will be available on HTTP port 3000 by default. Open your favorite browser and navigate to http://yourdomain.com:3000 or http://server-ip:3000 and complete the required the steps to finish the installation. If you are using a firewall, please open port 3000 to enable access to the control panel.

Congratulation’s! You have successfully installed Express.js. Thanks for using this tutorial for installing Express.js Web Server on your Ubuntu 16.04 LTS. For additional help or useful information, we recommend you to check the official Express.js web site.

How To Install FreeIPA on Ubuntu 16.04 LTS

Install FreeIPA on Ubuntu 16

FreeIPA is an open source identity management system for Linux/Unix environments which provides centralized account management and authentication, like Microsoft Active Directory or LDAP.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation FreeIPA open source identity management system on an Ubuntu 16.04 Xenial Xerus server.

Install FreeIPA on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing FreeIPA.

The first thing that we are going to do is to prepare the Ubuntu 16.04 server to run FreeIPA. In order to do this, we are going to set the IP address on the system, In our case the host IP is 192.168.1.2/24:

### nano /etc/hosts
192.168.1.2 ipa.wpcademy.com

Next, Install the package dependencies required for our setup with the following commands if they are not already installed:

ipa-server-install

Then, install FreeIPA using following command:

apt-get install freeipa-server freeipa-server-dns

After the FreeIPA installation, authenticate to the Kerberos realm to ensure that the administrator is configured correctly:

​​kinit admin

Ensure the following ports are opened in the security group of the FreeIPA Server:


    80,443
    tcp 88,464
    ldap 389

Step 3. Accessing FreeIPA.

FreeIPA will be available on HTTP port 80 by default. Open your favorite browser and navigate to https://ipa.wpcademy.local/ and complete the required the steps to finish the installation.

Congratulation’s! You have successfully installed FreeIPA. Thanks for using this tutorial for installing FreeIPA open source identity management system on your Ubuntu 16.04 LTS. For additional help or useful information, we recommend you to check the official FreeIPA web site.

How To Install Observium on Ubuntu 16.04 LTS

Install Observium on Ubuntu 16

Observium is a Network Management and Monitoring System that collects data from using SNMP and allows you to monitor all of the networks devices via an easy to use interface. It is PHP-based and uses a MySQL database to store data.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Conky system on a Ubuntu 16.04 (Xenial Xerus) server.

Install Observium on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Install LAMP (Linux, Apache, MariaDB, PHP) server.

A Ubuntu 16.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here. Also install all required PHP modules:

apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-mcrypt php7.0-xmlrpc php7.0-gd

Step 3. Installing Observium.

First, Go to Observium’s download page and download the latest stable version of Observium:

cd /opt
wget http://www.observium.org/observium-community-latest.tar.gz

Unpack the Observium archive to the document root directory on your server:

tar zxvf observium-community-latest.tar.gz

Step 4. Configuring MariaDB for Observium.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next we will need to log in to the MariaDB console and create a database for the Observium. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Observium installation:

CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'dbpassword';
flush privileges;
exit

Next, Copy the default configuration file ‘config.php.default‘ to ‘config.php‘ and fill out the database config options:

cd observium
cp config.php.default config.php

Changes the database configuration parameters with the ones created previously:

nano config.php

After you edit the file and modify the database parameters, the section should look like this:

// Database config --- This MUST be configured
$config['db_extension'] = 'mysqli';
$config['db_host'] = 'localhost';
$config['db_user'] = 'observium';
$config['db_pass'] = 'dbpassword';
$config['db_name'] = 'observium';

Give Apache user www-data ownership of the Observium web files:

chown -R www-data:www-data /opt/observium/html/

Run this script to Setup the MySQL database and insert the default schema:

./discovery.php -u

Create the directory to store RRDs in and set the proper ownership:

mkdir rrd
chown www-data:www-data rrd

Step 5. Configuring Apache web server for Observium.

Now we have to create the virtual host configuration for Observium. You can either add a new virtual host or alter the default one:

nano /etc/apache2/sites-available/000-default.conf

Add the following lines:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /opt/observium/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /opt/observium/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog  ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog  ${APACHE_LOG_DIR}/access.log combined
ServerSignature On
</VirtualHost>

Next, you need to enable rewrite functionality for your Apache server:

a2enmod rewrite

Enable the PHP mcrypt module:

phpenmod mcrypt

Now, we can restart Apache web server so that the changes take place:

systemctl restart apache2.service

Next, enter the observium directory:

cd /opt/observium

Add a first user with the use level of 10 for admin. The command sintax is below:

./adduser.php <username> <password> <level>

We are using the following:

./adduser.php wpcademy random_password 10

Step 6. Accessing Observium.

Observium will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/ or http://server-ip. If you are using a firewall, please open port 80 to enable access to the control panel.

Observium-login-page

Congratulation’s! You have successfully installed Observium. Thanks for using this tutorial for installing latest stable version of Observium on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Observium web site.

How To Install Nginx Amplify Agent on Ubuntu 16.04 LTS

Install Nginx Amplify Agent on Ubuntu 16

Nginx Amplify Agent is a Strong Nginx monitoring tool written in Python. Its function is to collect various metrics and metadata and send Them securely into the backend for storage and visualization. After appropriate Installation, it supplies you with NGINX Amplify web interface and also you Should observe real-time metrics to your monitored systems.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Nginx Amplify Agent monitoring tool on an Ubuntu 16.04 Xenial Xerus server.

Install Nginx Amplify Agent on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Nginx Amplify Agent on Ubuntu 16.04.

First, add the necessary public key with the command:

curl -fs http://nginx.org/keys/nginx_signing.key | apt-key add -

Configure the repository with the command:

# codename=`lsb_release -cs` && \
os=`lsb_release -is | tr '[:upper:]' '[:lower:]'` && \
echo "deb http://packages.amplify.nginx.com/${os}/ ${codename} amplify-agent" > \
/etc/apt/sources.list.d/nginx-amplify.list

Install the Nginx Amplify Agent using apt:

apt-get update
apt-get install nginx-amplify-agent

Creating the Config File from a Template:

api_key="KEY" && \
sed "s/api_key.*$/api_key = ${api_key}/" \
/etc/amplify-agent/agent.conf.default > \
/etc/amplify-agent/agent.conf

*Where KEY is the API key is the unique key assigned to your NGINX Amplify account.

Once installed, These commands can be used to start/stop the agent:

systemctl enable amplify-agent
systemctl start amplify-agent

Step 3. Configuring the Nginx Amplify Agent.

Checklist:

stub status
extended access logging
‘warn’ level on error logging


server {
 listen [::]:80;
 server_name bmw.wpcademy.com localhost [::1] 127.0.0.1;
 keepalive_timeout 60;

location /nginx_status {
 stub_status;
 access_log off;

allow ::1;
 allow 127.0.0.1;
 deny all;
 }
}

The logging needs to be confiured to have extended information as per the documentation:

log_format  main      '$remote_addr - $remote_user [$time_local] "$request" '
                      ' $status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      'rt=$request_time ua="$upstream_addr" '
                      'us="$upstream_status" ut="$upstream_response_time" '
                      'ul="$upstream_response_length" '
                      'cs=$upstream_cache_status' ;

Ensure warnings are logged to the error log:

error_log /var/log/nginx/error.log warn

Finally steps, You can overview the status of our monitored server in the Web interface logging to your Amplify Account as in the snapshot:
nginx-amplify-agent

Congratulation’s! You have successfully installed Nginx Amplify Agent. Thanks for using this tutorial for installing Nginx Amplify Agent monitoring tool on your Ubuntu 16.04 LTS. For additional help or useful information, we recommend you to check the official Nginx Amplify Agent web site.

How To Install Nim on Ubuntu 16.04 LTS

Install Nim on Ubuntu 16

Nim is a systems and applications programming language. Statically typed and compiled, it gives unparalleled functionality in an elegant package.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Nim programming language on a Ubuntu 16.04 (Xenial Xerus) server.

Install Nim on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Nim.

Nim is available on Ubuntu 16.04 repository. To install Nim we can run command below:

apt-get install gcc
apt-get install nim

Now we can check Nim version installed:

### nim -v
Nim Compiler Version 0.12.0 (2017-11-02) [Linux: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf

Next create sample hello world application for Nim. Create new file called hello.nim with contents below:

echo "Hello Nim! - wpcademy.com"

Compile the source code:

$ nim c hello.nim
Hint: system [Processing]
Hint: hello [Processing]
CC: hello
CC: system
Hint: [Link]
Hint: operation successful (9846 lines compiled; 0.910 sec total; 16.168MB; Debug Build) [SuccessX]

Now let’s execute the hello application:

### ./hello 
Hello Nim! - wpcademy.com

Congratulation’s! You have successfully installed Nim. Thanks for using this tutorial for installing latest stable version of Nim programming language on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Nim web site.