Typically, if a website has outgrown a shared hosting plan, a few issues can occur.
As well as worrying about the costs of upgrading to another, more powerful VPS, the owner of the site will need to think about running their own virtual private server.
Creating, owning, and configuring a virtual private server may sound somewhat daunting, but if you follow a few simple steps, you shouldn’t have to worry.
Thankfully, moving from shared hosting to a VPS (see also ‘5 Best: Free VPS Hosting‘) is pretty straightforward.
But, getting to know how to set up a VPS is a more difficult task. This is especially true if you have never had any experience with using the command line in the past.
Nevertheless, today at blogaholicdesigns.com, we are going to guide you through the main steps of setting up a VPS.
By the end of today’s post, you will have a much better understanding of how to achieve this and run your own virtual private server (see also ‘Top 10 Best Virtual Private Servers (VPS Hosting) For Beginners‘).
Make Your Own VPS – Steps
Most web servers use Unix-based systems to run. This means that the site owners have to use commands that are compatible with that type of unique operating system (OS).
As you can probably guess, these commands are different to those that are used on Windows machines.
With this in mind, let’s take a look at how to set up your own Virtual private Server with five steps.
Step One – Log Into Your Virtual Private Server With Secure Shell (SSH)
You can connect to a website using numerous methods, without using a browser. An example would be using File Transfer Protocol (FTP), allowing you to upload and download files onto your server.
FTP is a good method of connecting to a website but you cannot issue commands to the server this way. In order to achieve this, you will need to implement Secure Shell (SSH) access.
This protocol gives you access to remote servers. Once connected, you can then issue commands to it.
SSH is very secure thanks to its reliable authentication and encryption protocols. Learn how to use SSH, and you are well on your way to understanding server management.
When you have signed up for a VPS plan, you should be provided with certain credentials, supplied to you by your web host. These include your server’s IP address, a username (often a root), and a password.
A root account gives you full access to a specific type of system.
You will need to begin with a single root account when setting up a VPS and to set up your first connection. For Unix-based OS users, it is possible to connect to your server straight from the command line.
For Windows users, an SSH client will need to be installed first.
Two reliable clients are Bitvise and PuTTY.
Bitvise has an easy-to-use interface, whilst PuTTY’s interface is more minimalistic, but with more configuration options.
Today, we will use PuTTY as an example of how to make your VPS. here’s how to get started:
- Install PuTTY and start it up.
- A new window will pop up – here, enter your server’s IP address into the IP address, or host name.
- Leave the port setting to the value of 22 (default).
- If you see an option of which connection to use, select SH. Then, click the Open button.
- Now, a prompt will has you to enter your login details (the root and password).
- After logging in, you will see a summary of your server’s information and prompts to input further commands.
- Keep the command line window open for now.
Step Two – Updating The server
After you have logged in to your VPS, a message should appear, informing you of any security updates or packages available. You should always keep everything up to date, for your server to run smoothly.
To update your server:
- Type the apt update command and press Enter. Your server will now check for what packages require updating. This may take some time, though.
- Once your packages are updates, restart your server via the reboot command.
- Close the command window line and wait for a few minutes.
- Log in again.
Step Three – Make Another User And Update Its Applications
It’s always good to create another user account, as well as your root account, that has superuser privileges. Just one mistake with a command could irreparable damage your system when using a root account.
- You can set up a new user account by entering the command “adduser yournewusername” (replace “yournewusername” with your accrual new username).
- Now, type in “~ usermod -aG sudo yournewusername” to add the new user to the sudo group. This will give it more access and rights with your VPS.
- Finally, create a new password for the account.
Step Four – Public Key Authentication
Your password needs to be very strong. By using the Public key authentication technique, you can create a more secure password. To do this, you can use the PuTTY app. Search around your programs and run the PuTTY app.
You can use the default settings for your key pair. Here’s what to do:
- Select the Generate button. The program will prompt you to slide the mouse around for randomization.
- Now, the program will display the public key it generated. Here, you need to set up a passphrase to accompany this, so it can be a password beside the key.
- Choose the Save private key button before saving the file to your machine. Keep the window open for now.
- Log back into your server with your initial root user account. Type in “# su – yournewusername” to go to your new account’s home directory.
- Here, you will have to run a number of commands in a certain order. These will make a fresh folder for your public key, restrict permissions in that folder, and save the key. The commands are – mkdir ~/.ssh – chmod 700 ~/.ssh – nano ~/.ssh/authorized_keys.
- Copy your public key from the PuTTYgen window, and paste it into the Nano editor, which is opened by the final command.
- When the key is complete, select “CTRL + X” and this will close the editor.
- Enter “Y” when prompted to save the changes to the file.
- Now, type in the commands – chmod 600 ~/.ssh/authorized_keys – exit. The permissions for the file will now be changed for you to edit them.
- Select the Browse button and find the private key file. Select this.
- Finally, you need to disable the password-only authentication default method. Start by logging into your server, with your new user account, using SSH.
- Run the command – sudo nano /etc/ssh/sshd_config – here, the Nano editor will open. Search for PasswordAuthentication within the file, and then delete the “#” symbol. Change the value to “no” so it looks like “PasswordAuthentication no”
- Save your changes and reboot your server.
Step Five – Create a firewall
You’ll need to keep your server as secure as possible. To do so, you will need to enable a firewall to protect it. This can be achieved through the iptables program.
With iptables, you will be able to limit what ports allow access your server. This will prevent attacks from occurring. And, although the process can be a bit long-winded, it is a one-time thing.
So, do it now, and you don’t have to worry about it in the future.
In Summary
It is a big step when upgrading to a personal VPS from shared hosting. But, once you do so, you will have more features to take advantage of.
It will just take a little time to find your feet with this new process.
We hope this guide has helped you set up your own virtual private server. Once you have followed our steps, you can start enjoying it.
You should now understand the command line, too, which will make setting up anything on your server much easier from now on.
Thanks for reading.
- The 20 Best Blogging Courses That Are For Beginners - December 7, 2022
- 20 Best WordPress Plugins For Blogs For Effective Blogging! - December 7, 2022
- 5 Excellent Affiliate Marketing Courses To Learn - December 6, 2022