Various tutorials from programming to system administration. Topics include docker, javascript, angular, ubuntu, php and many others.
Saturday, December 10, 2016
Install OpenStack Mitaka under Virtualbox
Give it at least 6 GB RAM, having a 64-bit processor
Then create 3 networks:
NatNetwork(for connection with the external world) with address: 10.0.2.0/24, to support DHCP
and allow port forwarding which we will use to connect to the internal Virtual Machine (VM)s:
name:ssh, protocol: TCP, host IP: 10.0.2.15, host port 22, guest IP: 127.0.0.1, guest port:2022
this way you can use ssh or putty to connect to 127.0.0.1:2022 and access the internal Virtual machines.
Next, create 2 other host-only networks with the following details(for communication and data transfer):
ip:10.50.0.1
mask:255.255.255.0
and
ip:10.254.254.1
mask:255.255.255.0
both with DHCP disabled
SSH access:
If you experience problems connecting to the Virtual Machine, you can try to disable and stop the firewall:
sudo systemctl disable firewalld
sudo systemctl stop firewalld
add an exception for SSH access in the firewall
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
check the selinux configuration
sudo nano /etc/selinux/config
check the open ports on your network with:
1. find all the networks you would like to inspect:
ip a |more
2. Install and use Nmap to portscan those networks:
sudo yum install nmap
scan the open ports on the virtual machines:
nmap 10.0.2.*
nmap 10.254.254.*
Install CentOS host system
Download CentOS minimal ISO and boot up the machine via VirtualBox.
Once logged in in the VM, edit the sudoers file and place your account there: sudo cat /etc/sudoers
(instead of always typing sudo in front of the commands, you can write: sudo -i and continue working)
sudo dhclient - to make DHCP give access to the Virtual machines to outside(Internet) IP addresses
then edit /etc/resolv.conf sudo nano /etc/resolv.conf and add google nameserver 8.8.8.8 to be able to fetch internet websites from VM.
Configure the three network interfaces using information such as IP addresses from above :
cd /etc/sysconfig/network-scripts/
sudo nano ifcfg-enp0s3
sudo ifdown enp0s3
sudo ifup enp0s3
(repeat the process for enp0s9 and enp0s8)
check if the configuration is correct
ip a
Preparing installation
We need to install additional packages:
sudo yum install wget tcpdump curl
install network synchronizing time server
sudo yum install ntp
set the hostname of our virtual machine:
sudo hostnamectl set-hostname myopenstack.com
stop and disable network interference from Network Manager:
sudo systemctl stop NetworkManager.service
sudo systemctl disable NetworkManager.service
Upgrade to the latest available kernel to ensure better performance on virtualization and integration with VirtualBox:
enable elrepo kernel repository
yum --enablerepo=elrepo-kernel install kernel-ml
install ncurses library:
sudo yum install gcc ncurses ncurses-devel
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
install fastestmirror to get closest repository:
sudo yum install yum-plugin-fastestmirror
install the kernel:
sudo yum --enablerepo=elrepo-kernel install kernel-ml
Reboot the system to make new kernel effectively loading
sudo reboot
check the kernel version
uname -a
Installing OpenStack Mitaka
get the RDO-release:
sudo yum install http://rdo.fedorapeople.org/rdo-release.rpm
then install the RPM package: sudo yum install openstack-packstack
Generate answers file for easier installation configuration of OpenStack
sudo packstack --gen-answers-file=.answers.cfg
install OpenStack using the answer-file:
sudo packstack --answer-file=.answers.cfg
Upgrade the openstack distribution as well as all other CentOS packages
sudo yum upgrade
Enter OpenStack dashboard using browser
(in Windows you can install xming server - to allow access from outside to OpenStack via ssh graphical screen )
install xauth authorization
sudo yum install xauth
sudo yum groupinstall fonts
*start the graphical terminal xterm
export DISPLAY=:0.0
start firefox and open up OpenStack dashboard
firefox 10.254.254.100/dashboard
Congratulations, you can now start using OpenStack :)
Enjoy!
Saturday, December 03, 2016
How to install the newest kernel on Ubuntu
Being with the latest stable kernel usually brings lots of benefits resulting in:
- having the latest supported drivers for your hardware
- fixing commonly reported bugs
- increase in overall system performance
- various speed and stability related, software-oriented optimizations
Reference: Practical Ubuntu Linux Server for beginners
Here is a video of the update process:
In order to do a simple kernel upgrade, so to be sure to have the latest one installed.
First visit: https://www.kernel.org/
Then choose from stable or unstable(mainline) kernel branch you would like to have your kernel installed. Just look up the numbers. Note: r.c. has the meaning of release candidate, so the kernel is still in development.
Then go to http://kernel.ubuntu.com/~kernel-ppa/mainline/
You'll find a huge directory with supported kernels tailored for Ubuntu distributions.
Scroll down, to pick the chosen one and enter its directory. Then open up a terminal and write:
cd /tmpThis way we will enter the temporary folder, which will be erased automatically when we reboot our machine.
We have to download the proper kernel version. To check if we have 32 or 64-bit system installed type:
uname -mwhich if shows i686 then your kernel should be 32 bit, and if shows x86_64 then you have to download the 64-bit kernel packages.
Next point at the right kernel with the right mouse click, copy the link location from 3 files: one with a name ending on: _all, and two _generic .deb packages
linux-headers-4.15.2-041502_4.15.2-041502.201802072230_all.deb
linux-headers-4.15.2-041502-generic_4.15.2-041502.201802072230_amd64.deb
linux-headers-4.15.2-041502-lowlatency_4.15.2-041502.201802072230_amd64.deb
linux-image-4.15.2-041502-generic_4.15.2-041502.201802072230_amd64.deb
linux-image-4.15.2-041502-lowlatency_4.15.2-041502.201802072230_amd64.deb
from those we need to download everything, except the 2 lowlatency packages.
In terminal just enter wget then paste the link location. Here follows an example of the first package:
wget linux-headers-4.15.2-041502_4.15.2-041502.201802072230_all.debThe last step is to install the downloaded packages using sudo privileges:
sudo dpkg -i linux*Reboot the computer in order to load the new kernel:
sudo reboot
If you have problems with the newly installed kernel, just press several times on restart the 'ESC' key and choose from Advanced options the previous working stable kernel version.
After some time you may notice that kernels begin to pile up, thus reducing your disk space. I advise you to remove the redundant ones with: sudo apt remove linux- and then list the not used: modules, image and headers packages.
Congratulations and happy learning!
Wednesday, November 30, 2016
Install Laravel on Ubuntu
sudo apt-get install phpThen install and run composer which will take care of packages dependencies:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.phpcopy composer binary file into /sbin directory to be able to run composer from everywhere.
sudo mv composer.phar /usr/local/sbin/composeror update the local path to be able to access composer vendor binaries and later be able to run laravel: export PATH = "$HOME/.config/composer/vendor/bin:$PATH" . If you would like the path change to be persistent just add the line into the .bashrc file.
install the two minimal PHP libraries required for laravel:
sudo apt-get install php-mbstring
sudo apt-get install php-xmluse composer to create a new project called learning-laravel from a package named laravel/laravel. The new directory which package would get installed will be called learning-laravel:
composer create-project laravel/laravel learning-laravelenter into the new directory
cd learning-laraveland start a local listening PHP server on port 8888 and address localhost(127.0.0.1). This will also make PHP interpret all the files within the subdirectory /public:
php -S localhost:8888 -t publicOpen a browser on localhost:8888 Congratulations! You have installed a running Laravel project!
Monday, February 01, 2016
Internet Connection Sharing in Ubuntu
For this setup, you'll need 2 physical network cards installed on your server - one connected to your Internet provider, and the second connected to a hub or second computer. Reference: Practical Ubuntu Linux Server for beginners
1. Go to the upper right corner of the desktop and right-click on Edit connections. Then rename your both connections using the Edit button as 'incoming' (Internet provider) and 'localnet' (home network). If you don't know which one(eth0, eth1, etc.) is which just unplug cables one by one to check. This step will save you lots of trouble down the process.
2.Choose to Edit the 'localnet' connection, click on tab: IPv4 Settings and for method choose: 'Shared to other computers'. Repeat the same procedure for the 'incoming' connection, but this time choose DHCP.
(if you are using PPPOE)
Click on DSL - Edit and type your username and password given by the Internet provider.
3. Next you'll have to enable the two logical connections followed by the DSL connection(if you use one) by just clicking on them. During the process notice if 'wired media is connected' message appears. If the media gets connected and quickly disconnects you can try to disable the IPv6 Settings on the 'localnet' by setting their method to 'ignore'.
Also, it's necessary not to let the NetworkManager setup the default gateway for the 'localnet' connection, so just do:
# sudo nano /etc/NetworkManager/NetworkManager.confand set its managed parameter = 'false'.
Same can be achieved if you click on 'localnet' connection Routes button and check the 'Use this connection only for resources on its network'. This way its default gateway won't get overwritten by the NetworkManager.
Finally turn on the internal firewall with the command invoked in terminal:
# sudo ufw enableThis way your server setup is OK, now for the computers that want to use Internet click on Edit connections and just give them the 'localnet' configured IP address as a gateway.
Cheers!
Thursday, January 28, 2016
Install latest Ubuntu version under VirtualBox and set up ssh
Here is how to install Ubuntu in a virtual machine "Virtual Box" and set up an ssh server. Reference: Practical Ubuntu Linux Server for beginners
First install the free version of Virtual Box from Oracle website: https://www.virtualbox.org/ . Then open the program and let's create a new virtual machine from the button new.
Note: Ubuntu requires around 10GB of disk space and please make sure that all visualization instructions and software code protections are enabled within your BIOS.
Then we download the latest Ubuntu version from http://cdimage.ubuntu.com/daily-live/current
Now is time to start the virtual machine and open up the Ubuntu .iso file. The installation will start, where is important to choose the root partition mount point/.
Here is how to do the installation:
After finishing installation it is time to install the networking, but first please update the system by opening a terminal (Ctrl+t):
# sudo apt update
# sudo apt dist-upgradeIf you wish to install ssh server and use it within your network, this can be done the following way: To install an ssh-server in a terminal type:
# sudo apt install ssh-serverThen we have to remove the built-in network manager(which will mess with the static IP addressing we need to set) via:
# sudo apt purge network-managerAt this point you may notice that other virtual boxes could not contact your machine, this is because you have to set the virtual box networking model. So open VirtualBox Ubuntu image settings and set the virtual machine networking from NAT to BRIDGED, which means that it can use private addresses and set up servers on. Warning this will stop your internet access. Then restart the ubuntu virtual machine and is time to set up our network so type:
# sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0 upthis will set up your network interface card. If you want to make the changes persistent on the next restart you can place this information in /etc/network/interfaces file:
# sudo nano /etc/network/interfacesiface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.255
next you can do the same steps for other virtual installations of Ubuntu.
and try to connect to 192.168.0.1 via ssh client
# ssh 192.168.0.1 -l username
That's it. Enjoy learning !
Subscribe To My Channel for updates
-
Here is how to share your Internet connection in a way that other computers to be able to use it. Happy learning and be sure to check ...
-
Here we will be doing an installation of the development/production environment of PHP and MySQL using Docker under Ubuntu. Here is a full v...
-
Laravel installation under Docker seems a painful experience but at the same time, it is a rewarding learning experience. The following are ...