How To Install VNC Server on CentOS 7

Install VNC Server on CentOS 7

VNC (Virtual Network Computing) server is a free and open source software which is designed for allowing remote access to the Desktop Environment of the server to the VNC Client whereas  VNC viewer is used on remote computer to connect to the server .

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. I will show you through the step by step installation VNC server on CentOS 7.

Step 1. First, you need to update the system to ensure that we have all of the latest software installed.

 yum update


Step 2. Install Gnome desktop.

 yum groupinstall "GNOME Desktop"

Step 3. Install tigervnc server and X11 fonts.

 yum install tigervnc-server xorg-x11-fonts-Type1

Copy the VNC server configuration file to /etc/systemd/system/ for configuring the system service. While copying, you can mention which port it should listen. By default VNC server listens on 5900:

 cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:5.service

Edit VNC server file configuration:

 nano /etc/systemd/system/vncserver@:5.service
## Replace <USER> with your real user, in my case i replaced with user called “wpcademy” with the screen size ##
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
ExecStart=/sbin/runuser -l wpcademy-c “/usr/bin/vncserver %i -geometry 1280×1024″
PIDFile=/home/wpcademy/.vnc/%H%i.pid
ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'[Install]
WantedBy=multi-user.target

Step 4. Configure firewall rules to allow the VNC connection.

firewall-cmd --permanent --zone=public --add-port=5905/tcp
firewall-cmd --reload

Step 5. Start VNC server.

 vncserver

Set the password.

You will require a password to access your desktops.

Password:
Verify:
xauth:  file /home/wpcademy/.Xauthority does not exist

New ‘localhost.localdomain:1 (wpcademy)’ desktop is server.wpcademy.net:1

Creating default startup script /home/wpcademy/.vnc/xstartup
Starting applications specified in /home/wpcademy/.vnc/xstartup
Log file is /home/wpcademy/.vnc/server.wpcademy.net:1.log

Step 6. Enabling and starting the VNC service

Reload the systemctl daemon as root.

 systemctl daemon-reload

Start the VNC service as root:

 systemctl start vncserver@:5.service

Enable it on system startup as root:

 systemctl enable vncserver@:5.service

Step 7. Now you can able to connect VNC server using IP and Port ( Eg : 192.168.2.109:5 ) and you will be asked to enter the password, enter the password that you have created earlier.

vnc server authentication

CentOS-7-VNC-Desktop

Congratulation’s! You have successfully installed VNC server. Thanks for using this tutorial for installing VNC server on CentOS 7 system.

You Might Also Like: How To Install VNC Server on CentOS 6

How To Install Apache Solr on Ubuntu 14.04

apache solr on ubuntu

Apache Solr is an open source enterprise search platform used to easily create search engines which searches websites, files and databases. Its major features include powerful full-text search, faceted search, distributed search, hit highlighting and index replication. But before you proceed, make sure you have already installed Tomcat which is necessary to access Solr from the browser.

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. I will show you through the step by step installation Apache Solr on Ubuntu 14.04.

Step 1. First, Install Java.

Because tomcat and solr are Java based softwares we need the Java environment (As it is advised in the Solr wiki : prefere a full JDK to a simple JRE.)

Add the webupd8team Java PPA repository in your system:

 sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo aptitude -y install oracle-java8-installer

Verify installed Java version:

#java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

Step 2. Install Apache Solr.

Ubuntu provides 3 Solr packages by default: nsolr-commo, the package that contains the actual Solr code; solr-tomcat, Solr integrated with Tomcat; and solr-jetty, which is just like solr-tomcat but with the Jetty web server. In this article, we will install solr-tomcat, so execute the following command:

 sudo apt-get -y install solr-tomcat

Then let’s start the server:

 sudo service tomcat6 start

Important: the config & index will be stored at : /usr/share/solr/

Step 3. Install tomcat management utilities.

 sudo apt-get install tomcat6-admin

Once installed, you’ll have to grant some user:

 sudo nano /etc/tomcat6/tomcat-users.xml

Paste these lines (change username and password as you whish):

<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="manager,admin"/>

Step 4. Accessing Apache Solr.

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

apache solr web admin

Congratulation’s! You have successfully installed Apache Solr. Thanks for using this tutorial for installing Apache Solr on Ubuntu 14.04 system.

You might also like: How To Install Apache Solr on CentOS 6

How To Install Apache Solr on CentOS 6

install apache solr on centos

In this tutorial we will learn how to Install Apache Solr on CentOS.

Apache Solr is an open source enterprise search platform used to easily create search engines which searches websites, files and databases. Its major features include powerful full-text search, faceted search, distributed search, hit highlighting and index replication.

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. I will show you through the step by step installation Apache Solr on CentOS 6.

Step 1. Install Java.

Download latest Java SE Development Kit 8 release from its official download page or use following commands to download from shell:

### CentOS 64-Bit ###
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz"
tar xzf jdk-8u40-linux-x64.tar.gz
### CentOS 32-Bit ###
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-i586.tar.gz"
tar xzf jdk-8u40-linux-i586.tar.g

Verify Installed Java version:

# java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

Step 2. Install Solr.

Download the latest version of solr and extract it (5.0.0 is the latest at time of writing):

cd /opt
http://www.us.apache.org/dist/lucene/solr/5.0.0/solr-5.0.0.tgz
tar -xvf solr-5.0.0.tgz
mv /opt/solr-5.0.0 /opt/solr
mv /opt/solr/example /opt/solr/core

Step 3. Create script for handling the Solr server service.

Create a systemd service for Solr or if you are used to the old init scripts, you can keep using them. Create an init script for the Solr service:

 nano /etc/init.d/solr
#!/bin/bash
#
# chkconfig: 2345 20 20
# short-description: Solr
# description: Startup script for Apache Solr Server

SOLR_DIR="/opt/solr/core"
LOG_FILE="/var/log/solr.log"
JAVA="/usr/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"

start() {
echo -n "Starting Solr... "
cd $SOLR_DIR
$JAVA > $LOG_FILE 2>&1 &
sleep 2
RETVAL=$?

    if [ $RETVAL = 0 ]
    then
        echo "done."
    else
        echo "failed. See error code for more information."
    fi
    return $RETVAL
}

stop() {
echo -n "Stopping Solr... "
pkill -f start.jar > /dev/null
RETVAL=$?

    if [ $RETVAL = 0 ]
    then
        echo "done."
    else
        echo "failed. See error code for more information."
    fi
    return $RETVAL
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: solr {start|stop|restart}"
exit 3
esac
exit $RETVAL

Save the file and make it executable:

chmod +x /etc/init.d/solr
chkconfig --add solr

Start Solr using the following command:

 /etc/init.d/solr start

Step 4. Configure Iptables or Firewall.

If you use iptables add a rule to allow access to Solr’s admin section and query Solr data:

 iptables -A INPUT -p tcp -m tcp --dport 8983 -j ACCEPT
service iptables save

Step 5. Accessing Apache Solr.

Apache Solr will be available on HTTP port 8983 by default. Open your favorite browser and navigate to http://yourdomain.com:8983/solr/  or http://server-ip:8983/solr/.

apache solr web admin

Congratulation’s! You have successfully installed Apache Solr. Thanks for using this tutorial for installing Apache Solr on CentOS 6 system.

You Might Also Like: How To Install Apache Solr on Ubuntu 14.04

How To Install Java JDK 8 on CentOS 6

install java jdk on centos 6

There are many programs and scripts that require java to run it, but usually Java is not installed by default on VPS or Dedicated Server. 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. I will show you through the step by step installation Java JDK 8 on CentOS 6.

Step 1. Remove the Java 1.6 or 1.7 have been installed already, you can uninstall them using the following commands.

yum remove java-1.6.0-openjdk
yum remove java-1.7.0-openjdk

Step 2. Downloading latest Java archive.

Download latest Java SE Development Kit 8 release from its official download page or use following commands to download from shell:

### CentOS 64-Bit ###
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz"
tar xzf jdk-8u40-linux-x64.tar.gz
### CentOS 32-Bit ###
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-i586.tar.gz"
tar xzf jdk-8u40-linux-i586.tar.g

Step 3. Install JAVA using alternatives.
After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package:

# cd /opt/jdk1.8.0_40/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_40/bin/java 2
# alternatives --config java
There are 3 programs which provide 'java'.
  Selection    Command
-----------------------------------------------
*  1           /opt/jdk1.8.0/bin/java
 + 2           /opt/jdk1.8.0_25/bin/java
   3           /opt/jdk1.8.0_40/bin/java
Enter to keep the current selection[+], or type selection number: 3

At this point JAVA 8 has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives:

alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_40/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_40/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_40/bin/jar
alternatives --set javac /opt/jdk1.8.0_40/bin/javac

Step 4. Verify Installed Java version.

# java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

Step 5. Setup global environment variables.

We can easily set the environment variables using the export command as shown below:

Setup JAVA_HOME Variable:

 export JAVA_HOME=/opt/jdk1.8.0_40

Setup JRE_HOME Variable:

 export JRE_HOME=/opt/jdk1.8.0_40/jre

Setup PATH Variable:

 export PATH=$PATH:/opt/jdk1.8.0_40/bin:/opt/jdk1.8.0_40/jre/bin

Congratulation’s! You have successfully installed Java. Thanks for using this tutorial for installing Oracle Java (JDK) 8 on CentOS 6 system.

How To Install Java JDK 8 on Ubuntu 14.04

install java jdk on ubuntu

In this tutorial we will show you how to install and configuration of Java on your Ubuntu 14.04 server. There are many programs and scripts that require java to run it, but usually Java is not installed by default on VPS or Dedicated Server.

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 Java JDK 8 on a Ubuntu 14.04 server.

Install Java JDK 8 on Ubuntu 14.04

Step 1. Remove the OpenJDK from the system, if you have it already installed.

 sudo apt-get remove --purge openjdk*

Step 2. Add the webupd8team Java PPA repository in your system.

 sudo add-apt-repository -y ppa:webupd8team/java

Step 3. Install Java JDK 8

After added the PPA, run commands below one by one to install Java JDK 8:

sudo apt-get update
sudo aptitude -y install oracle-java8-installer

Step 4. Verify Installed Java Version.

 java -version

Result:

java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

Congratulation’s! You have successfully installed Java. Thanks for using this tutorial for installing Oracle Java (JDK) 8 on Ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official Java web site.

How To Install Cacti on CentOS 6

install cacti on centos

Cacti is an open-source, web-based network monitoring and graphing tool designed as a front-end application for the open-source, industry-standard data logging tool RRDtool. It is used by IT businesses and stores all of the necessary information about bandwidth, hard disk usage, CPU usage, load average, RAM statistics etc in a MySQL database. Cacti creates graphs and populates them with data. It offers SNMP support, 3rd party templates and plugins and has built in user authentications and user permission features.

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. I will show you through the step by step installation Cacti on CentOS 6.

Step 1. First, you need to enable EPEL repository on your system.

## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

Step 2. Install required packages.

Install apache:

 yum install httpd httpd-devel

Install MySQL server:

 yum install mysql mysql-server

Intsall PHP modules:

 yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql

Install PHP-SNMP:

 yum install php-snmp

Install NET-SNMP:

 yum install net-snmp-utils p net-snmp-libs

Install RRDTool:

 yum install rrdtool

Once installed all the above softwares, start them:

/etc/init.d/mysqld start
/etc/init.d/httpd start
/etc/init.d/snmpd start

In order for these services to run at startup we need to enter the following commands:

chkconfig mysqld on
chkconfig httpd on
chkconfig snmpd on

Step 2. Install Cacti.

chkconfig mysqld on
chkconfig httpd on
chkconfig snmpd on

Step 3. Configuring MySQL.

By default, MySQL is not hardened. You can secure MySQL 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 MySQL.

 mysql_secure_installation

Cacti requires a MySQL user and database, so create them by executing the following commands:

# mysql -u root -p
create database cacti;
grant all privileges on cacti.* to 'cactiuser'@'localhost' identified by 'your-password-here';
flush privileges;
exit

Step 4. Setup Cacti tables to MySQL.

Now import cacti database tables from the file cacti.sql . Issue the below command to find the location of cacti.sql file:

#rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.8a/cacti.sql

Now we need to install the tables into the cacti.sql file. Use the following command to do this and enter your database password when prompted:

 #rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.8a/cacti.sql

Now we need to edit the database configuration file of cacti so that it uses the correct database name and username:

 mysql -u cactiuser -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql

Configure MySQL settings for Cacti. Open /etc/cacti/db.php with your favourite editor and enter the values for your ‘cacti’ database:

 nano /etc/cacti/db.php
/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "your-password-here";
$database_port = "3306";
$database_ssl = false;

Step 5. Configure the Apache Server.

We can change the Apache configuration to choose what IP addresses / subnets are allowed to connect. You can do this by editing the following file:

##nano /etc/httpd/conf.d/cacti.conf

<Directory /usr/share/cacti/>
 Order Deny,Allow
 Deny from none
 Allow from <YOUR_IP_ADDRESS_RANGE>
 </Directory>

Restart Apache:

 /etc/init.d/httpd restart

Step 6. Configure Cron for Cacti.

Open /etc/cron.d/cacti file:

nano /etc/cron.d/cacti
###Remove the # in the following line###
#*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Step 7. Configuring Iptables or firewall for Cacti.

iptables -A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
service iptables save

Step 8. Accessing Cacti.

Cacti will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/cacti or http://server-ip/cacti. The default username and password for Cacti is admin / admin. Upon first login, you will be force to change the default password.

Congratulation’s! You have successfully installed Cacti.

How To Install Winusb on Ubuntu 14.04

install winusb ubuntu

WinUSB is simple tool allows to create bootable Windows USB install stick from Ubuntu Linux.  It comprises of both GUI and command line tool and you can decide to choose which to use based on your preference. This tool supports Windows 7, 8, Vista, XP and can use either an ISO or a DVD as a source. Currently there is no version for Ubuntu 14.04 in Ubuntu Repository. To successfully install Winusb on Ubuntu 14.04, you need to install the Saucy version and run the dependencies fix switch to fix the dependencies.

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. I will show you through the step by step installation Winusb on Ubuntu 14.04.

Step 1. Download the winusb package that is compatible with your operating system’s architecture

Open the terminal and run the following commands:

##for Ubuntu 32-Bit##
wget https://launchpad.net/~colingille/+archive/freshlight/+files/winusb_1.0.11+saucy1_i386.deb

##for Ubuntu 64-Bit##
wget https://launchpad.net/~colingille/+archive/freshlight/+files/winusb_1.0.11+saucy1_amd64.deb

Step 2. Install Winusb.

 sudo dpkg -i winusb_1.0.11+saucy1*

Step 3. Fix dependencies errors.

 sudo apt-get -f install

Step 4. Afterwards, you can search for WinUSB in Unity Dash and use it to create a live USB of Windows in Ubuntu 14.04.

winusb ubuntu

These three steps will install the WinUSB graphical interface and the WinUSB command line tool. The WinUSB GUI is much easier to use than the WinUSB command line tool.

Congratulation’s! You have successfully installed Winusb. Thanks for using this tutorial for installing Winusb on Ubuntu 14.04 system.