How To Replacing OpenSSH With Dropbear on CentOS

Replacing OpenSSH With Dropbear on CentOS

Dropbear is a relatively small SSH server and client. It runs on a variety of POSIX-based platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for “embedded”-type Linux (or other Unix) systems, such as wireless routers.

Features

  • A small memory footprint suitable for memory-constrained environments – Dropbear can compile to a 110kB statically linked binary with uClibc on x86 (only minimal options selected)
  • Dropbear server implements X11 forwarding, and authentication-agent forwarding for OpenSSH clients
  • Can run from inetd or standalone
  • Compatible with OpenSSH ~/.ssh/authorized_keys public key authentication
  • The server, client, keygen, and key converter can be compiled into a single binary (like busybox)
  • Features can easily be disabled when compiling to save space
  • Multi-hop mode uses SSH TCP forwarding to tunnel through multiple SSH hosts in a single command. dbclient user1@hop1,user2@hop2,destination

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. In this tutorial we will learn through the step by step replacing Dropbear SSH in CentOS server.

Replacing OpenSSH With Dropbear on CentOS

To install, first you must add the yum repository information corresponding to your CentOS/RHEL version to yum:

For CentOS 6.x use:

#wget http://dl.fedoraproject.org/pub/epel/6/i386/dropbear-0.58-1.el6.i686.rpm
#rpm -Uvh dropbear-0.58-1.el6.i686.rpm

For CentOS 5.x use:

#wget http://dl.fedoraproject.org/pub/epel/5/i386/dropbear-0.55-1.el5.i386.rpm
#rpm -Uvh dropbear-0.55-1.el5.i386.rpm

First we will just install dropbear using yum:

 #yum install dropbear

Now we just need to start up new SSH server:

 #nano /etc/init.d/dropbear

Edit port dropbear:

 #OPTIONS=" -p 222"

Add dropbear to startup and start the sever:

#chkconfig dropbear on
#service dropbear start

Next you can stop the current OpenSSH server:

 #yum remove openssh-server

Note: Make sure you check that it is indeed running and verify from another box before you logout your current session otherwise.

Congratulation’s! You have successfully installed Dropbear. Thanks for using this tutorial for installing Dropbear SSH in CentOS system.

How To Install Mtop (MySQL Database Server Monitoring) on CentOS 6

Install Mtop On CentOS 6

Mtop is an open source real time MySQL Server monitoring program that shows queries which are taking longer time to process and kills those longer queries after certain number of specified time. Mtop program enable us to monitor and identify performance and related issues of MySQL Server from the command line interface similar to Linux Top Command. In this tutorial we will show you how to install and configuration of Mtop (MySQL Database Server Monitoring) on your CentOS 6 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. Here is the step by step installation Mtop on CentOS 6.

Install Mtop (MySQL Database Server Monitoring) on CentOS 6

Step 1. First, you need to enable RPMForge repository under your Linux machine to download and install latest version of MTOP program.

## RHEL/CentOS 6 32-Bit ##

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

## RHEL/CentOS 6 64-Bit ##

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Step 2. Install Mtop using yum.

 yum install mtop

Step 3. Starting Mtop.

To start Mtop program, you need to connect to your MySQL Server, using following command:

# mysql -u root -p

mysql> grant super, reload, process on *.* to mysqltop;
Query OK, 0 rows affected (0.00 sec)

mysql> grant super, reload, process on *.* to mysqltop@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye

Step 4. Running Mtop in CentOS 6.

 mtop

Mtop usage and functions keys:

s – change the number of seconds to delay between updates
m – toggle manual refresh mode on/off
d – filter display with regular expression (user/host/db/command/state/info)
F – fold/unfold column names in select statement display
h – display process for only one host
u – display process for only one user
i – toggle all/non-Sleeping process display
o – reverse the sort order
q – quit
? – hel

Congratulation’s! You have successfully installed Mtop. Thanks for using this tutorial for installing Mtop (MySQL Database Server Monitoring) on CentOS 6 system.

Read more from mtop/mkill – MySQL Monitoring Tools Official Website

You Might Also Like: How To Enable Slow Query Log for MySQL

How To Install Suhosin PHP 5 Protection Security Patch on CentOS

Install Suhosin PHP 5

Suhosin (pronounced ‘su-ho-shin’) is an advanced protection system for PHP 5 installations. It is designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core. Suhosin comes in two independent parts, that can be used separately or in combination. The first part is a small patch against the PHP core, that implements a few low-level protections against buffer overflows or format string vulnerabilities and the second part is a powerful PHP extension that implements numerous other protections.

In this tutorial we will show you how to install Suhosin PHP 5 protection security patch on CentOS.

Install Suhosin PHP 5 Protection Security Patch on CentOS

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Download latest version of Suhosin:

#yum install php-devel
#http://download.suhosin.org/suhosin-0.9.35.tgz
#tar -xvf suhosin-0.9.35.tgz

 Next, run the following commands to compile Suhosin under PHP 5:

#cd suhosin-0.9.33
#phpize
#./configure
#make
#make install

Create the suhosin configuration, type the following command:

 #echo 'extension=suhosin.so' > /etc/php.d/suhosin.ini

Restart web server Nginx, Lighttpd or Apache:

#service nginx restart
#service lighttpd restart
#service httpd restart

Step 3. Verify Suhosin installation

 #php -v

Suhosin should now be installed. You can check by creating a file called info.php in /var/www/html/ with the following content:

<?php
phpinfo();
?>

installed php-suhosin successfully

The features of the Suhosin patch are listed under Engine Protection (only with patch); all the other features come with the Suhosin extension. But if you would like configure it according to your setup, then visit the suhosin configuration page for more information.

How To Backup and Restore MySQL Database Using Command Line

Backup and Restore MySQL Database

Many of the world’s largest and fastest-growing organizations including Facebook, Google, Adobe, Alcatel Lucent and Zappos rely on MySQL to save time and money powering their high-volume Web sites, business-critical systems and packaged software.

In this tutorial we will guide you through two easy ways to backup and restore the data in your MySQL database using mysqldump. You can also use this process to move your data to a new web server. We assume that you already have MySQL installed on Linux system with administrative privileges and we assume that you already have badic knowledge on MySQL and command line or terminal.

The parameters of the said command as follows.

  • [uname] Your database username.
  • [passwd] The password for your database (note there is no space between -p and the password).
  • [dbname] The name of your database.
  • [backupdb.sql] The filename for your database backup.

Backup and Restore MySQL Database Using Command Line

Backup MySQL database

First, you can check MySQL databases from your server:

#mysql -h localhost -u root -p
#mysql> show databases;

The following command will dump all databases to an sql file. Replace pass with your root database password and filename with the name of the file you wish to create such as backupdb.sql

Back up multiple databases in MySQL

 #mysqldump –u[uname] –p[passwd] [database name 1] [database name 2] > backup.sql

Example:

 #mysqldump –u root –pidroidus chedelics radiks > backup.sql

Backup all databases in MySQL

 #mysqldump –u [uname] –p[passwd] –all-databases > backup.sql

Example:

 #mysqldump –u root –pidroidus –all-databases > backup.sql

Back up your MySQL Database with Compress

 #mysqldump -u root -p[passwd] --databases [dbname] | gzip > backup.sql.gz

Example:

 #mysqldump -u root -pidroidus --databases  | gzip > backup.sql.gz

Restore MySQL database from a backup file

Above we backup the Tutorials database into backupdb.sql file. To re-create the Tutorials database you should follow two steps:

  • Create an appropriately named database on the target machine
  • Load the file using the mysql command:
 #mysqladmin -u root -p create [dbname]
 #gzip -d backupdb.sql.gz #mysql -uroot -p[passwd] [dbname] < backupdb.sql

Example:

#mysqladmin -u root -p create chedelics
#gzip -d backupdb.sql.gz
#backupdb.sql
#mysql -uroot -pidroidus chedelics < backupdb.sql

You Might Also Like: How To Reset Root Password on MySQL Server

How To Install Nginx Web Server on Ubuntu

Install Nginx Web Server on Ubuntu

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy. So today I’m going to show you how to setup Nginx webserver on Ubuntu or Debian. It’s really not that difficult. Let’s start with Nginx.

This tutorial we will learn how to install Nginx on Ubuntu so that you can successfully run a superior performance based web server while easing the load on your system resources.

Install Nginx on Ubuntu

Step 1. To install, first you must update apt repository and packages by typing the below command:

 sudo apt-get install nginx -y

Step 2. Install Nginx,

Installing Nginx is as simple as running just one command:

 sudo apt-get install nginx

Starting and stopping the Nginx server

To start the Nginx server, issue the following command:

 sudo service nginx start

Top stop the Nginx server, issue the following command:

 sudo service nginx stop

Configuration Nginx files/folders

  • The main configuration file for Nginx is /etc/nginx/nginx.conf
  • Virtual hosts are defined in /etc/nginx/sites-available/default
  • PHP will be configured in /etc/php5/fpm/php.ini

Before you close that terminal window, it’s necessary to set the Nginx service to start at boot. Just issue the following command:

 update-rc.d nginx defaults

This should already be enabled by default, so you may see a message like this:

 System start/stop links for /etc/init.d/nginx already exist

Navigating to your Server’s IP address (assuming you have no other server listening on port 80), you will be greeted with the standard welcome page:

nginx-default

The steps above should produce a running Nginx which serves the Nginx default pages on port 80. We’ll start working through various configurations and optimizations to round out the series. Enjoy your new web server! For additional help or useful information, we recommend you to check the official Nginx web site.

 

How To Install and Configure Squid 3 on CentOS

Install and Configure Squid 3 on CentOS

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL.

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.

In this tutorial we are going to learn how to install and configuration of Squid on your CentOS server.

Install and Configure Squid 3 on CentOS

Step 1. To install, first you must update yum repository and packages by typing the below command:

 #yum -y update

Step 2. Installing Squid 3.

Install squid package and dependencies using the below command :

 #yum -y install squid

Step 3. Configuration Squid.

Edit squid configuration file ‘/etc/squid/squid.conf’

 #nano /etc/squid/squid.conf
# Recommended minimum configuration:
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl SSL_ports port 443
acl Safe_ports port 80        # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http
acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
http_port 3128

hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
cache deny all

refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern .        0    20%    4320

icp_port 3130

forwarded_for off

request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all
visible_hostname wpcademy.com

Step 4. Create our authentication file which Squid can use to verify for user authentications:

 #htpasswd -b /etc/squid/squid_passwd username password

Example:

 #htpasswd -b -c /etc/squid/squid_passwd ranty ratna

Congratulation’s! You have successfully installed squid. Thanks for using this tutorial for installing squid proxy on CentOS system. For additional help or useful information, we recommend you to check the official squid web site.

You Might Also Like: How To Install Redis on Ubuntu 16.04 LTS

How to install Java on Ubuntu

How to install Java on Ubuntu

There are many programs and scripts that require java to run it, but usually Java is not installed by default on VPS/Dedicated Server. In this tutorial we are going to learn a simple step to install Java on your Ubuntu machine.

Java is at the heart of our digital lifestyle. It’s the platform for launching careers, exploring human-to-digital interfaces, architecting the world’s best applications, and unlocking innovation everywhere—from garages to global organizations.

Java technology allows you to work and play in a secure computing environment. Upgrading to the latest Java version improves the security of your system, as older versions do not include the latest security updates.

Java allows you to play online games, chat with people around the world, calculate your mortgage interest, and view images in 3D, just to name a few.

install Java on Ubuntu

First step, update apt-get repository

 apt-get update

Second step, install java run time

 apt-get install default-jre

Third step, install java development kit

 apt-get install default-jdk

Fourth step, check java installation

 java -version

Result:

java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

OK that’s all for now the tutorial to install Java Runtime and Java Development Kit on Ubuntu.

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

You Might Also Like: How To Install Oracle Java on Ubuntu 17.04