How to install Ubuntu 18.04 Desktop

How to install Ubuntu 18.04 Desktop fresh using Hyper-V manager on Windows 10 Pro to Quick Create. There are many ways to install it, this process is very simple, you could do manual, which requires you to download the Ubuntu 18.04 image, then go through the process of installation. This will give you options to use your Ubuntu virtual desktop and get a feel of Linux system, when not in use, turn it off, so it goes not take resources of your system.

Open your Hyper-V Manger

Right click on Hyper-V host and choose Quick Create …

Then you will get option to select the Operating system, choose Ubuntu 18.04 LTS, and click Craete Virtual Machine. If you want to rename your VM, you could click on More options or you can rename later.

Then it will go through downloading the Ubuntu 18.04 LTS image, depending on your internet speed it may take awhile.

Then it will go through the automatic process of creating VM:

  • Verifying image
  • Extracting disk from an image archive
  • Creating a Hard drive
  • Virtual machine create successfully

Then you should see option to connect to your new Ubuntu 18.04 Desktop, click Connect

Click on Power button or Start to turn on your Ubuntu 18.04 server

You should see starting and then Welcome screen. Select your Language then click Continue

Select Keyboard layout, then click Continue

Select your Timezone, then click Continue

Fill in the login info, this would be admin account to login to your server, then click Continue

Then it will go through the System configuration automatically

Then you should see login screen enter your user/password created earlier

You should see your New Ubuntu 18.04 Desktop, it gives you few tips on What’s new in Ubuntu, go though and start using your Ubuntu Virtual desktop.

You can start using your Ubuntu 18.04 virtual desktop, see tips and tricks of common things you may find helpful, if this is your first time use of Ubuntu system.

Tips and Tricks:

Remove icon from favorites

Just right click icon you want to remove and choose Remove from Favorites

Opened applications

You will see little dot next to the application, you tell you that application is open.

More than one Application open

You will see more than one little dots, if you click on it, it will give you thumb nail view of and you will be able to switch it or close the application.

To see all opened Applications

Click on the Activities and it will give you thumbnail view of all opened applications, you can switch to it, or close it by click on X.

To see Applications

You can click on 9 dotted icon bottom left hand side, you will see all application or Frequent used

  • Software – where you can install new applications
  • Software & Updates – Where you can install updates and third-part software options
  • Startup Application – gives you list of application at start of your Ubuntu system
  • Settings – list of all settings like control panel
  • Files – your documents or personal files
  • Rhythmbox – is default music player

Shutdown Ubuntu Virtual Machine

Click on the Arrow on top left, you will see Power icon, if you want to just lock it, click on Lock icon.

When you click on Power icon it will give you option to Restart/Power off or cancel

Change User info

If you need to change user name or any setting, click on the Arrow next to your user name it will give you option to make changes

Change default applications

Click on Settings>Default Applications>Then change it to what you like



Nagios network monitor upgrade to Version 4.4.3

Nagios is a great open source network monitor released new version 4.4.3 last month.  It’s a great free tool, you can customize to fit your network and monitor live.  Know the issues before your user’s reports to you, you can see the history of your network health, so you know your network is stable or find out if you are having some issues in some part of your network.  So keeping up with the newest version to monitor your network is very important.  Let’s get started first, make sure you have a good backup and check your Nagios config if you have any errors correct it first.  Also, if you are using any plugin make sure they support the new version too.  I am using Ubuntu server and Apache for a web server.

To check the Nagios health:

Command: nagios -v /usr/local/nagios/etc/nagios.cfg

Your path to Nagios might be different and unless you are sudo user you will need to use sudo command.  You may have some warning of deprecated, you can update it and fix it before the update something like this:

WARNING: The retry_check_interval attribute is deprecated and will be removed in future versions. Please use retry_interva                l instead.

If everything looks good, then next download new version of Nagios.  You can download the Nagios core from https://www.nagios.org/downloads

at download page choose Nagios Core, then new version: 4.4.3

Update process:

  1. Extract: tar –zxvf nagios-4.4.3.tar.gz
  2. switch to the directory: cd nagios-4.4.3/
  3. Stop Nagios service: service nagios stop
  4. Run command to check: ./configure –with-command-group=nagios
  5. If everything is fine:  make all
  6. Then install it: make install

Check Nagios confignagios  -v / usr/local/nagios/etc/nagios.cfg

If any errors found then fix it and re-run the check config until no errors found, then start Nagios service: service nagios start

You might need to restart the apache2 service or whatever your web server is:  service apache2 restart

That’s it

Resources:

Nagios Core Manuals



Encrypt TLS-SNI-01 validation is reaching end-of-life

If you are using Let’s Encrypt certification and have received an email to take action on renewal of your certificate.  That’s because lets Encrypt had announced last October 2018, that they will end support for TLS-SNI-01 validation method on February 13, 2019.  You need to update your ACME client to use an alternative validation method alternative validation method: HTTP-01, DNS-01 or TLS-ALPN-01. If no action taken you may have out-dated certificate for your domain.

To check your certbot version:

certbot –version

If have your server up to update, then the version should be 0.28.  If not you can upgrade your Certbot at https://certbot.eff.org/.   It will ask you to pick your software and system and it will give you detail documentation on how to upgrade, baased on your version of software/system.

To install for Apache, you can run this command:

sudo apt-get install python-certbot-apache

To test do a renewal dry run:

sudo certbot renew –dry-run

If everything goes well you should see Congratulation, all renewals succeeded, if it fails then you need to fix it. Take a look at log, firewall to make sure it’s not been blocked and try again.

Here is a link from Let’s Encrypt Community Support on How to stop using TLS-SNI-01 with Certbot Please update your server certificate to keep it secure.



How to upgrade Ubuntu 14.04 to 16.04

If you are still running Ubuntu server 14.04, which will be End of Life this Aril 2019, so you should upgrade to 16.04 or 18.04. You can check out Ubuntu Release dates at https://wiki.ubuntu.com/Releases Even though Linux is more secure, that does not mean it should not be kept up to date, to keep your data safe. Longer you keep put out the updates harder it gets, due to many changes on each upgrade. You can check out my post on How to secure your Ubuntu server. Make sure you have a good backup and your backup is tested to be sure data you are backup are good. If you have an option you can do an upgrade on a test server and work out any issues, that way when you do upgrade on production system it goes smooth.

Check list before starting upgrade process

  • Data backed up and verified
  • Make sure your application supports newer packages versions
  • List of application/services so it can be tested after the upgrade
  • Direct access to the server, remote session will give you an error
  • Stopping application/services, not required but if dealing with a database it’s safer
  • Double check storage space for an upgrade to download/install

Login to server directly to do the upgrade
Command: sudo do-release-upgrade

It will go through a list of currently installed packages and then let you choose if you want to go for the upgrade or not.  If you need more details you should press d otherwise press y and ENTER

You may get a message like this select Yes, so if any services needed to be restarted it will automatically without asking you each time. It will start the process of removing obsolete packages, downloading, installing and setting up automatically, unless you have chosen No.

You may get this message and you can make your own choice to keep current version or install newer, you can select to show differences between the versions

It will go though upgrade process, then if everything goes well you should see message System upgrade is complete, then restart by pressing y and Enter key, so your server can restart to finish upgrading.

If everything went well you should see login screen

After an upgrade, you should do the following

  • This will check for any updates:
    • sudo apt-get update
  • This will install any updates that it found:
    • sudo apt upgrade
  • This will remove any packages no longer needed:
    • sudo apt-get autoremove 
  • Then check your application/services to make sure they are running and if there any errors fix it.

That’s it, hope this helps out someone out there, good luck

Common issues and solutions:

If you are remotely doing upgrade you will get this warning, if something goes wrong with your SSH connection while you are in the middle of an upgrade, then you would have issues getting into your server

You may have issues with PHP version, most likely you may have been running version 5.6, installing the PHP7.0 might fix your issues or newer version:

sudo apt-get install -y libapache2-mod-php7.0



How to secure your Ubuntu server

As you may know, already there are many ways to secure Ubuntu server based on your environment and version of OS. Double checking to be sure you are secure does not hurt at all, but don’t go overboard by locking your self from accessing own server. I have been working with Ubuntu server since Ubuntu 5.04 back in 2007, but have not done any post about it and was not using that much as I am now. Ubuntu Linux system has come a long way for sure, now even power users start using their desktop version. For the most part default security secures your server from any major attack to your server. There are many attacks are from within your own environments and some lazy admin or management who don’t want to pay for support or just keeps post ponding updates. Anyways here I have some list of tweaks I have been using and learning more from other Linux admins on internet.

Keep your server up to date:


sudo apt-get update This will search for an update of your current version and packages that in installed
sudo apt-get upgrade This will install the updates and packages
sudo apt-get dist-upgrade This will look for newer next LTS version

Check supported Releases:
https://wiki.ubuntu.com/Releases

Remove unnecessary packages

sudo apt-get auto-remove
sudo apt-get purge NameOfPackage

Enable built-in basic Uncomplicated Firewall (ufw): by allowing only need services name or ports

ufw allow ssh
ufw allow 80
ufw allow ftp

Disabled telnet: very old but have seen people still using it
apt-get remove telnet

Check for hidden open ports with:

netstat

Set a shorter timeout for root sessions

edit /etc/profiles
[ $UID -eq 0 ] && TMOUT=600.
The $UID -eq 0 part refers to the user with the ID of 0 — always root.
The TMOUT=600 or 900 part sets the timeout limit to 10-15 minutes (600-900 seconds)

Change default SSH port from 22 to something else and disable Root user:

Port 22 > Port 90xx or whatever port you want (don’t forget to add a new port to your firewall)
edit /etc/ssh/sshd_config:
PermitRootLogin yes > PermitRootLogin no

Limiting allowed users to login via SSH:

edit /etc/ssh/sshd_config to have ssh login for specific users
bottom of the file, add the line x=device you going to log in from IP or just type User1 User2, etc…
AllowUsers YourUserName@192.xxx.xxx.x
if you need to use a wildcard: to allow any username and from x=network:
AllowUsers @192.xxx.xxx.*

You could also add a Group:
Create group:
groupadd -r SSHGroupName

Add allowed group to /etc/ssh/sshd_config
AllowGroups SSHGroupName

Then add user to the group:
usermod -a -G SSHGroupName user1

service ssh restart

edit /etc/ssh/sshd_config to have ssh login for specific users
bottom of the file, add the line x=device you going to log in from IP
AllowUsers YourUserName@192.xxx.xxx.x
if you need to use a wildcard: to allow any username and from x=network:
AllowUsers @192.xxx.xxx.*

service ssh restart

Add Login Banner which displays before user login:

edit /etc/issue.net
add your own warning message whomever login can see

Then edit /etc/ssh/sshd_config and uncomment the line:
Banner /etc/issue.net

some more options to disable server info by comment out:

edit /etc/pam.d/sshd
session optional pam_motd.so motd=/run/motd.dynamic

network messages to allow or disable (like ICMP, redirects, SYN, etc..):
edit /etc/sysctl.conf

Blocking IP spoofing:


edit /etc/host.conf
change from “multi on” to “nospoof on”

To Turn off Server Signature:

edit /etc/apache2/apache2.conf and add these 2 lines at the end of the config file. Most cases user types wrong URL or by IP address, it display’s your web server info by default.
ServerSignature Off
ServerTokens Prod

service apache2 restart

Hide PHP Version

edit (your version of PHP maybe different) /etc/php/7.0/apache2/php.ini
expose_php = Off

You may have older version of PHP:
/etc/php5/apache2/php.ini
expose_php = Off

Also youcould add to your .htaccess file:
# Disable server signature
ServerSignature Off

will add more later on