How to change ssh port in CentOS 6?

Changing SSH port is a very important security tip and helps  in avoiding bruteforce attacks on server.

By default ssh port is 22 on all the servers, it can be easily changed by editing the ssh configuration files.
Connect normally on ssh from  22 port and We will start with installing text editor nano.

$ yum install nano -y

and now we will edit the config of ssh.

$ nano /etc/ssh/sshd_config

After running the last command you will be taken to the nano editor where you will have  to find this line and uncomment.

Change “#Port 22” to  “Port 22” by removing # and change the 22 to the port  number you want it to changed, for eg. “Port 9824”.  Press Ctrl+O to save and press enter again to confirm and then press Ctrl+x to exit nano editor.

After saving we will restart ssh on server.

$ service sshd restart

It will result in successfully changing the ssh port and you will be able to access your server from the port that you put in.

How to install apache server in CentOS 6 and 7?

What is apache web server?
The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server, released under the terms of Apache License 2.0.

Apache is most common server used by companies or individuals to run their website. It is very popular and easy to install. It is very like that apache is already installed  on your server but we will still guide you in case it is not.

We will update the server before installing apache. Connect  on server and run this command.

$ yum  update -y

After updating we will install apache.

$ yum install httpd -y

It will install the apache server and now we will check if apache is running or not.

$ service httpd status
$ service httpd restart

You will now be able to open the apache default web page by opening http://IP which means your server is up and running. You  can now upload your content in /var/www/html/ and your website will be  ready to go on the  IP.

We can also host multiple websites, change the web directory, change the the port, and many other things by editing httpd.conf. We will cover that in  further tutorials.

How to install OpenVPN on CentOS 6?

What is OpenVPN?
OpenVPN is an open-source software application that implements virtual private network techniques to create secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities

Lets get started with tutorial now,
We suggest using a freshly installed CentOS 6 server.

Connect to the server using SSH and update the server using command mentioned below, it will take 5-10 minutes depending on the speed of your server.

$ yum update -y

And now we will install the dependencies of OpenVPN. The command below will install the dependencies required by OpenVPN.

$ yum install gcc make rpm-build autoconf.noarch zlib-devel pam-devel openssl-devel iptables -y

We will fetch RPM file from OpenVPN servers by  using this command

$ wget http://swupdate.openvpn.org/as/openvpn-as-2.0.17-CentOS6.x86_64.rpm

After fetching RPM file,  we will run it.

$ rpm -i openvpn-as-2.0.17-CentOS6.x86_64.rpm

And after running it, you will get something like this.

You should get a link with “https://IPHERE”, now go to it and you should see the OpenVPN access server page.

Login with root or create user and login. You will be  able to download OpenVPN client from the same link after logging in.

At the end, run the OpenVPN the client, login and enjoy!

How to connect on a ssh server?

Connecting on a server using ssh can be a challenging task for a beginner. People usually do not understand what to do, where to go, and what software to use. It is because most us are familiar with using GUI based OS and are not aware that how command line OS works.

What is SSH?

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.[1] The best known example application is for remote login to computer systems by users.

How to connect on SSH server from Windows OS?

You will need a software named putty to make an ssh connection. You can download the latest version of putty from this link.
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

When you open  putty, you will see an interface like this.

 

You will enter the IP address of server in Host Name(or IP address) box and enter the ssh port. It is very likely that your ssh port by default is 22. When you click on open, a window like this will pop up.

 

You will have to type your ssh username(most of the time root) and press enter and then you will be asked to enter password.
Note:
1. The password that you type is not visible.
2. The standard Ctrl+C doesn’t work on putty to enter password.
3. Getting Connection timed out means that your server is down and connection refused means your ssh port is something else or closed.
4. After copying password,  you can just right click in window to paste anything.

After entering your ssh password, you will be able to send commands to your server and ready to go!