How To Change Hostname on Ubuntu 16.04 LTS

Change Hostname on Ubuntu 16

Hostname is a label used to identify the machine and will help you to easily distinguish the server from another one. The hostname should be a Fully Qualified Domain Name (FQDN) and should point to the server IP address so you can access the server by using it.

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 tutorial 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. If you are ready open up your terminal and follow through this tutorial, and in less than 10 minutes you will have changed your hostname on a Ubuntu 16.04 server.
Change Hostname on Ubuntu 16.04 LTS

Step 1. First I will check the current hostname by running “hostnamectl status” on the shell of my server:

hostnamectl status

The output on my system is:

[root@wpcademy ~]# hostnamectl status
Static hostname: wpcademy
Icon name: computer-vm
Chassis: vm
Machine ID: 20f9865d34b5a4637a9a4ffokeocef6da37
Boot ID: 28d1685056d743b39e57a7okeocefe467f
Virtualization: oracle
Operating System: Ubuntu 16.04 LTS
CPE OS Name: cpe:/o:ubuntu:ubuntu:16.04
Kernel: Linux 3.10.0-042stab120.3
Architecture: x86_64

Step 2. Change and Set Hostname.

To change the hostname type the command:

hostnamectl set-hostname vps1.wpcademy.com

Check the host name again (Close the session and open new session using console):
[php]
[root@wpcademy ~]# hostnamectl status
Static hostname: vps1.https://wpcademy.com
Icon name: computer-vm
Chassis: vm
Machine ID: d89865d34b5a4637a9a4ffokeocef6da02
Boot ID: 56d1685056d743b39e57a7okeocefe467c
Virtualization: vmware
Operating System: Ubuntu 16.04 LTS
CPE OS Name: cpe:/o:ubuntu:ubuntu:16.04
Kernel: Linux 3.10.0-042stab120.3
Architecture: x86_64

In each of these configurations, you’ll need to be sure your hostname conforms to the standards for FQDNs (Fully Qualified Domain Names). The ASCII letters a – z, the digits 0 – 9, and the hyphen (‘-‘) are the only characters acceptable (the first character, however, cannot be a hyphen). You may also find it necessary (or useful) to include the domain name as well, in which case you would then also use periods (dots) to separate the hostname and the domain name (and top-level domain).

For more command options you can add the –help flag at the end.

# hostnamectl --help
hostnamectl [OPTIONS...] COMMAND ...

Query or change system hostname.

-h --help Show this help
--version Show package version
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--transient Only set transient hostname
--static Only set static hostname
--pretty Only set pretty hostname
Commands:
status Show current hostname settings
set-hostname NAME Set system hostname
set-icon-name NAME Set icon name for host
set-chassis NAME Set chassis type for host
set-deployment NAME Set deployment environment for host
set-location NAME Set location for host

Congratulation’s! You have successfully change hostname. Thanks for using this tutorial how to change and set hostname on your Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Ubuntu web site.

How To Install Thunderbird Email Client on Ubuntu 16.04 LTS

Install Thunderbird Email Client on Ubuntu 16

Mozilla Thunderbird is world’s leading email client software; it is free, open source, cross platform, works flawlessly, designed to handle high flow of emails. Not only email client, it is one of the best chat and news client app as well. Mozilla Thunderbird is being used by millions of people all around the globe on daily basis to cater their email and news needs. It is lighting fast app and is extremely lightweight, it hardly contributes to your system load or high resource consumption.

Install Thunderbird Email Client on Ubuntu 16.04 LTS

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 Thunderbird Email Client on a Ubuntu 16.04 (Xenial Xerus) server.

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 Thunderbird.

Let’s Add the Thunderbird repository under Ubuntu and its derivatives:

sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa

Install Thunderbird package using apt-get command:

sudo apt-get update
sudo apt-get install thunderbird

That’s it, you’ve successfully installed Thunderbird 45.6.0 under your Linux system.

installed thunderbird

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

How To Install DenyHosts on Ubuntu 16.04 LTS

Install DenyHosts on Ubuntu 16

DenyHosts is a log-based intrusion prevention security tool for SSH servers written in Python. It is intended to prevent brute-force attacks on SSH servers by monitoring invalid login attempts in the authentication log and blocking the originating IP addresses. Due to the simplicity of DenyHost and the ability to manually configure your rules it is widely used as an alternative to Fail2ban which is a bit more complicated to use and configure. DenyHosts unfortunately does not support IPv6.

DenyHosts v2.1 includes the following:

  • restricted username feature,
  • Synchronization download resiliency.
  • reset on success
  • Synchronization mode is now supported by command line/cron version (with the –sync flag)

Install DenyHosts on Ubuntu 16.04 LTS

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 DenyHosts on a Ubuntu 16.04 (Xenial Xerus) server.

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 DenyHosts on Ubuntu 16.04.

Install denyhosts package using apt-get command:

sudo apt-get install denyhosts

Step 3. Configure DenyHosts.

Once the Denyhosts installed, make sure to whitelist your own IP address, so you will never get locked out. To do this, open a file /etc/hosts.allow:

sudo nano /etc/hosts.allow

Below the description, add the each IP address one-by-one on a separate line, that you never want to block. The format should be as follows:

# hosts.allow This file contains access rules which are used to
# allow or deny connections to network services that
# either use the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
sshd: 114.124.37.154
sshd: 114.121.131.131
sshd: 172.16.25.156

You can further configure any settings in the DenyHosts.conf file by going to the following and updating according to your preference:

sudo nano /etc/denyhosts.conf

Save your work and restart DenyHosts by running the commands below:

systemctl restart denyhosts.service
systemctl enable denyhosts.service

View DenyHosts logs:

tail -f /var/log/denyhosts
tail -f /var/log/secure

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

How To Install Jenkins on Ubuntu 16.04 LTS

Install Jenkins on Ubuntu 16

Jenkins is an open source continuous integration tool written in Java. Jenkins provides continuous integration services for software development. It is a server-based system running in a servlet container such as Apache Tomcat. It supports SCM tools including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, Clearcase and RTC, and can execute Apache Ant and Apache Maven based projects as well as arbitrary shell scripts and Windows batch commands.

install jenkins on ubuntu 16

Install Jenkins on Ubuntu 16.04 LTS

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 Jenkins on a Ubuntu 16.04 (Xenial Xerus) server.

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 Java.

In this step, we will install Java 7 from a PPA repository and install python-software-properties:

apt-get install python-software-properties

Then you can add Java repository:

add-apt-repository ppa:openjdk-r/ppa

Update the Ubuntu repository and install the Java OpenJDK with apt command:

apt-get update
apt-get install openjdk-7-jdk

Verify Java installation by typing the command below:

java -version

Step 3. Installing Jenkins.

Add the key and source list to apt:

wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | sudo apt-key add -

Create a sources list for Jenkins:

sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

After the cache has been updated, start proceed installation Jenkins:

sudo apt-get update
sudo apt-get install jenkins

Start Jenkins service:

systemctl start jenkins

Jenkins will write log files to /var/log/jenkins/jenkins.log. You can also fine-tune the configuration.

Step 4. Installing and Configure Apache web server for Jenkins.

Install Apache web server on your system:

apt-get install apache2

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘jenkins.conf’ on your virtual server:

a2enmod proxy
a2enmod proxy_http
a2ensite jenkins
touch /etc/apache2/sites-available/jenkins.conf
ln -s /etc/apache2/sites-available/jenkins.conf /etc/apache2/sites-enabled/jenkins.conf
nano /etc/apache2/sites-available/jenkins.conf

Add the following lines:


ServerName my.jenkins.id
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode

Order deny,allow
Allow from all

ProxyPass / http://localhost:8080/ nocanon
ProxyPassReverse / http://localhost:8080/
ProxyPassReverse / http://my.jenkins.id/

Save and close the file. Restart the apache and jenkins service for the changes to take effects:

systemctl restart apache2
systemctl restart jenkins

Step 5. Accessing Jenkins.

Jenkins will be available on HTTP port 8080 by default. Open your favorite browser and navigate to http://yourdomain.com:8080 or http://server-ip:8080 and complete the required the steps to finish the installation. If you are using a firewall, please open port 8080 to enable access to the control panel. Default installation password can be found at /var/lib/jenkins/secrets/initialAdminPassword as showing in below image.
jenkins-installation
Congratulation’s! You have successfully installed Jenkins. Thanks for using this tutorial for installing Jenkins on Ubuntu 16.04 Xenial Xerus server. For additional help or useful information, we recommend you to check the official Jenkins web site.

How To Install Memcached on Ubuntu 16.04 LTS

Install Memcached on Ubuntu 16

Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.

install memcached on ubuntu 16 example

Install Memcached on Ubuntu 16.04 LTS

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 Memcached on a Ubuntu 16.04 (Xenial Xerus) server.

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 Memcached.

Now use following command to install memcached service on your system:

sudo apt-get -y install memcached

Step 3. Configuration Memcached.

The default configuration file can be found at:

nano /etc/memcached.conf

When started, Memcached will start on port 11211 by default per the default configuration file:

# Default connection port is 11211
-p 11211

Exit and save the configuration file, and then restart Memcached:

systemctl restart memcached

Install Memcached extension for PHP

You will also need to install required php extension for memcached:

apt-get install php-memcached

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

systemctl restart apache2

To test PHP, create a test file named info.php with he content below. Save the file, then browse to it to see if PHP is working:

nano /var/www/html/info.php
<!--?php phpinfo(); ?-->

Try to access it at http://your_server_ip/info.php . If the PHP info page is rendered in your browser then everything looks good and you are ready to proceed further.

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

How To Install Jekyll on Ubuntu 16.04 LTS

Install Jekyll on Ubuntu 16

Jekyll is a static site generator with a templating system that can be adapted for many types of websites, including blogs. It can be run on a server, or run locally and the generated files uploaded to a server. It is the default software used by Github Pages.

Install Jekyll on Ubuntu 16.04 LTS

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 Jekyll on a Ubuntu 16.04 (Xenial Xerus) server.

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 Ruby.

You need to install ruby using the following command:

sudo apt-get install ruby-full

Step 3. Installing Jekyll.

Install Jekyll package using gem:

gem install jekyll

We can test Jekyll is working by checking the version installed:

jekyll -v

Step 4. Create blog and up the server using Jekyll.

Now we are ready to create the blog and run the server. The below given command create the directory called wpcademyblog. You can given another name of your choice. In this directory, jekyll configuration file and setup is all set:

cd /home
jekyll new wpcademy.comblog

Change to newly created directory wpcademyblog or the new name which you have given at the time of using command jekyll:

cd wpcademy.comblog

Start the Jekyll application and replace below mentioned ip address with your ip:

jekyll server --host 192.168.77.21 &

Step 5. Accessing Jekyll.

Jekyll will be available on HTTP port 4000 by default. Open your favorite browser and navigate to http://yourdomain.com:4000 or http://server-ip:4000/
jekyll-linux
Congratulation’s! You have successfully installed Jekyll. Thanks for using this tutorial for installing Jekyll on Ubuntu 16.04 LTS (Xenial Xerus) system. For additional help or useful information, we recommend you to check the official Jekyll web site.

How To Install Django on Ubuntu 16.04 LTS

Install Django on Ubuntu 16

Django is a popular Python framework for writing web applications. Web frameworks like Django provide a set of tools which helps the developer to write the application faster as the framework takes care of the internal structure, thus the developer needs to take care of the application development only. Django is free and open source software.

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 Django on a Ubuntu 16.04 (Xenial Xerus) server.
Install Django 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 pip and necessary dependencies.

Now you can install pip using the following command:

sudo apt-get install python3-pip

Step 4. Installing Djanggo on Ubuntu 16.04.

Once the pip is installed, run the following command to install Django:

sudo pip3 install django

To verify the Django version, run:

django-admin --version

Step 5. Create a sample Django project.
Now that the Django framework has been installed, you can to give it a test drive by creating a sample project:

cd ~
django-admin startproject myproject

The command above will create a directory myproject in your working directory ~, and store all necessary files within.

Run the commands below in sequence to get your application started. Follow the instructions on screen to provide the superuser’s credentials:

cd myproject/
python3 manage.py migrate
python3 manage.py createsuperuser
python3 manage.py runserver 0.0.0.0:8000

Step 6. Accessing Django.

Django will be available on HTTP port 8080 by default. Open your favorite browser and navigate to http://yourdomain.com:8000 or http://server-ip:8000/admin

Verifying

To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django:

>>> import django
>>> print(django.get_version())
2.2

Congratulation’s! You have successfully installed Django. Thanks for using this tutorial for installing Django web framework on Ubuntu 16.04 Xenial Xerus server. For additional help or useful information, we recommend you to check the official Django web site.