網頁

2015年12月26日 星期六

ZeroShell 3.4.0 ---- How to quickly install ZeroShell on VMware "vmdk" disk.


I want to build a Router device on virualization environment for message exchange and hope it is simple and easy to create/setup one. In Google search, I find out an open source software “ZeroShell” and it is comfortable for installing and managing this.
ZeroShell is Linux Router with more feature as router, firewall, Radius and so on. Although someone has already share the installation methond on Internet, I just think whether it can convert image file so that don’t need to do the steps too much.
How to do it?

Download ZeroShell Image
Go to the ZeroShell Official Web and download the latest img file.imageExtract xxx.img.gz file to xxx.img next to confirm whether exist a QEMU-IMG tool. (# 1)

Convert .img to .vmdk image
If there is ever install qemu-utils package on debin/ubuntu system, we can directly by using the qemu-img convert –f raw xxx.img –O vmdk xxx.vmdk command (# 2)imageIf it is installed on windows platform, we will do the qemu-img convert –O vmdk xxx.img xxx.vmdk command
image
When the vmdk file is created, we will begin to create a New Virtual Machine on wmware production as wmware workstation.
In the configuration wizard, we can select the following parameter:
      Guest Operation System: Linux
      Version: Other Linux 3.x kernel 64-bit
      Memory: large than default value 384 MB
      Network Connection: at least large than two interface
      Virtual Disk Type: IDE
      Disk: Use an existing virtual disk as the converted vmdk file
It is important to chose the boot mode is BIOS, not EFI mode !!!
Once the setting is completed, we can start this VM and beging to setup the IP Address and Default Gateway on console mode now.
image
Reference:
(# 1)
   In Ubuntu/Lubuntu Trusty 14.04, we can install QEMU-IMG tool by using the sudo apt-get install qemu-utils command
image          
           In Windows Platform, we can download/install QEMU binaries for Windows
image
(# 2)   “qemu-img” Disk Image Utility 

2015年11月29日 星期日

KVM 2.0.0 --- How to install KVM and Virtual Machine Manager on Lubuntu 14.04

In Linux environment, we have other choice to create virtual machines besides VirtualBox or VMware. That is KVM.
KVM (Kernel-based Virtual Machine) is a virtualization extension for the Linux Kernel. We can use KVM to run both Windows and Linux in virtual machines.

The following guide will explains how to install and use KVM for creating and running virtual machines on an Lubuntu 14.04 LTS Desktop.

  1. Preprequisite Check
KVM will work only if the CPU is suitable for Intel VT or AMD-V hardware virtualization. We can run the sudo egrep -c '(vmx|svm)' /proc/cpuinfo command to find whether the cpu supports virtualization features
※ The 0 value means the processor doesn't support VT-x extensions, but values greater than 1 mean it does.



Check the hardware compatible by using sudo kvm-ok command (# 1)

To see what kernel is 32-bit or 64-bit by using uname -ri command (# 2)
※ In 32-bit kernel, the memory size of a VM will be limited to 2GB and only can install 32-bit guest VM.

  1. Install KVM and other packages
    1. By doing sudo apt-get update command, downloads the package lists from the repositories and "updates" them to get information on the newest versions of packages and their dependencies.

    1. Install Qemu package
      1. For enabling KVM hypervisor, we can install Kernal based Virtual machine(qemu-kvm) and CPU emulator(qemu) by using the sudo apt-get install qemu-kvm qemu command.

    1. Install libvirt library
      1. For interacting with the virtualization capabilities of recent versions of Linux, we can install libvirt package by using sudo apt-get install libvirt-bin command

    1. Install network utility
      1. For setting up networks on VM, we can install the bridge-utils package by using sudo apt-get install bridge-utils command

    1. Install graphical interface
      1. For managing KVM based virtual machines, we can install Virt-Manager(Virtual Machine Manager) graphical tool by using the sudo apt-get install virt-manager command.

※ On Lubuntu/Ubuntu, we can directly install another tool “ubuntu-vm-builder” that can be used for provisioning Ubuntu builds by using the sudo apt-get install ubuntu-vm-builder command.


  1. Delegate permission
In the moment, only the root user and users in the libvirtd group have permission to use KVM virtual machines. So that we have to add the specifial user account to the libvirtd group by using the sudo adduser libvirtd command
or using sudo adduser ‘id -un’ libvirtd command for logon account.

After do it, we have to log off and log on so that the user can run virtual machine now.

  1. Verify Installation
    1. Verify whether the KVM daemon is up and running by using the lsmod | grep kvm command.
    1. Check kvm daemon version by using the kvm --version command
    1. Verify whether the libvirt-bin daemon is up and running by using the sudo service libvirt-bin status command.
    1. Check libvirt-bin daemon version by using the libvirtd --version command
    1. Check whether kvm and libvirtd exist in /etc/group by using sudo cat /etc/group command
    1. Check whether libvirt-qemu and libvirt-dnsmasq exist in /etc/passwd by using sudo cat /etc/passwd command
    1. Check KVM installation status by using the sudo virsh -c qemu:///system list command

  1. Network Setup (virbr0 NAT interface)
The default network mode is the User mode and uses a predefined virbr0 (# 3) brigge which is NAT routed to the guest computer. The NAT routing uses the kernel's ip_forwarding feature and iptables.

To see the default User network setting by using the sudo virsh net-dumpxml default command
When the libvirt default network is running, you will see an isolated bridge device. This device explicitly does *NOT* have any physical interfaces added, since it uses NAT + forwarding to connect to outside world.

  1. Create a new VM
Once the installation completes, we can lanuch Virtual Machine Manager in GUI mode by using the sudo virt-manager command. (# 4)
To right-click the localhost(QEMU) and click New in menu, it will start a wizard for creating the new virtual machine.

Reference:
(# 1)     If we run the kvm-ok command, we can realize whether VT-x funciton is switched on and need to enable VT-x in the BIOS setting.
If this commad never be installed, we can install cpu-checker package by using the sudo apt-get install cpu-checker command to help evaluate the CPU feature.

(# 2)    Because KVM is not compatible with Xen, make sure Linux is not running a Xen kernel by running the uname -a command.
If you see output similar to “2.6.18-164.el5Xen”, a Xen kernel is running and must be stopped or remove before install KVM.

(# 3)   To disable virbr0 NAT interface by using the following command
# virsh net-destroy default
# virsh net-undefine default
# service libvirtd restart

(# 4)   If you don't want to run as root, the user you want to use needs to have rw access to /dev/kvm
(# 5)   After installing the libvirt and its GUI front-end virt-manager, the defalut location of VM image will be created on /var/lib/libvirt/images directory.

2015年11月22日 星期日

Eclipse 4.5.1 --- How to install Eclipse 4.5.1 on Lubuntu 14.04

Since Eclipse Mars(4.5 or later) release, we have another choice to install Eclipse package on any platform. It is very simple and quick way to lead us to do it, not do a self-extracting compressed file. That is Eclipse Installer.

How to do it?

Download the Eclipse Installer from Eclipse Official WebSite and choose the right version for the platform.

Extract the download file next to launch the Installer "eclipse-inst" file by sudo or directly execution.

Select a package and click it that we want to install the Eclipse IDE for java EE Developers

Select the installation folder where we want Eclipse to be installed next to click INSTALL button.
If install it by normal account, the suggestion is the installation folder need to choose under the home directory of this account.

Click Accept Now button to accept the Eclipse Foundation Software user Agreement

The Installing process is running and will friendly tell us that it will be taking longer time.

Once the installation is complete and then we will click the LAUNCH button.

Select a workspace and enable check box about “Use his as the default and do not ask again” next to click OK button

So does that the Eclipse IDE function will be ready now.


2015年10月9日 星期五

Cacti --- Install Cacti 0.8.8b by YUM on CentOS 7.x

Cacti tool is an open source web based network monitoring and system monitoring graphing solution for IT business. Cacti enables a user to poll services at regular intervals to create graphs on resulting data using RRDtool. Generally, it is used to graph time-series data of metrics such as network bandwidth utilization, CPU load, running processes, disk space etc.


According to Cacti Official Document, the Cacti requires that the following software is installed on CentOS environment.
  • Apache
  • MySQL(or MariaDB) 5.x or later
  • PHP 5.1 or later
  • RRDTool 1.0.49 or later (1.4+ recommend )


Install the required packages
  • Apache
Based on RPM OS, we need to install the required packages as follows:
Install Apache by using the yum install httpd httpd-devel command


  • MySQL(or MariaDB)
Install MariaDB (# 1) by using the yum install mariadb-server command


  • PHP
Install PHP by using the yum install php php-mysql php-ldap php-xml php-pear php-common php-gd php-devel php-mbstring php-cli command


Install PHP-SNMP by using the yum install php-snmp command


Install NET-SNMP by using the yum install net-snmp-utils net-snmp-libs command


  • RRDTools
Install RRDTool by using the yum install rrdtool command


Set PHP Timezone
Due to the host's timezone has already been defined by running the timedatectl set-timezone Asia/Taipei command
we have to set the date.timezone value like the system in the /etc/php.ini file as follows:


Start HTTPD, MySQL and SNMP service
To start HTTPD, MySQL and SNMP service by entering following command in your console:
# systemctl start httpd.service

# systemctl start mariadb.service

# systemctl start snmpd.service


If we want to automatically start HTTPD, MySQL and SNMP daemon on boot time, we have to do the command as follows:
# systemctl enable httpd.service
# systemctl enable mariadb.service
# systemctl enable snmpd.service


Setup MySQL database and User Accounts
To set MySQL “root” new password for new MySQL installation by using the mysqladmin -u root password command


To login into MySQL Server with “root” new password next to create MySQL “cacti” database with user “cactidbuser” and passowrd “09877890


Install Cacti by YUM
To enable EPEL repository by using the yum install epel-release command
and install cacti through YUM command by using the yum install cacti command


Import cacti table to MySQL cacti database
To find out the cacti.sql file path by using the rpm -ql cacti | grep cacti.sql command


To import cacti tables into newly created cacti database by using the mysql -u cactidbuser -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql command and the process need to type the cacidbuser password 09877890


Configure MySQL setting
To edit the /etc/cacti/db.php file and change the following content as follows:
/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactidbuser";
$database_password = "09877890";
$database_port = "3306";
$database_ssl = false;


AS-IS
TO-BE


Configure Apache to Network Access
To edit a file /etc/httpd/conf.d/cacti.conf for enabling access to Cacti application from the local network or IP level.
AS-IS
TO-BE
If set ALL to allow access to cacti
       
If set IP Range to allow access to cacti
       We can replace the above red tag with the following bold font.
               # httpd 2.4
    Require host localhost
   Require host 10.0.0.0/8
   Require host 172.16.0.0/12
               Require host 192.168.0.0/16
             
               # httpd 2.2
               Allow from localhost
   Allow from 10.0.0.0/8
   Allow from 172.16.0.0/12
               Allow from 192.168.0.0/16
            
Set scheduled task
Cacti uses cron (scheduled task) in order to execute its polling process.  We can uncomment the following line in a a /etc/cron.d/cacti file
*/5 * * * *    cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
AS-IS
TO-BE


To set this new user with the ownership and permission of the rra and log directories.
# chown -R cacti /usr/share/cacti/rra
# chmod 775 -R /usr/share/cacti/rra
# chown -R cacti /usr/share/cacti/log
# chmod 775 -R /usr/share/cacti/log


Open http port in Firewall
Confiugre firewall for Cacti
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --reload


Restart HTTPD, MySQL and SNMP service
To restart HTTPD, MySQL and SNMP service by entering following command in your console:
# systemctl restart httpd.service
# systemctl restart mariadb.service
# systemctl restart snmpd.service


Setup Cacti at the first time
If the above procedure has already been finished, we can go to http://YOUR-IP-HERE/cacti/ and follow the installer instruction through the following screens


Please choose installation Type as "New Install" and then click Next >> button


Make sure all the following values are correct next to click Finish button.


In the Cacti Login Screen, enter username as admin and password as admin by default.
Once you've entered username and password, it will ask you to enter a new password for cacti.
Now we can see the dashboard of the cacti.


Reference:
(# 1)   Due to RedHat changes the default DB policy in RHEL/CentOS 7.x, it still install MariaDB if we want to install MySQL as RHEL/CentOS 6.x environment  by using the yum install mysql mysql-server command.




Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.