Getting Started with DigitalOcean
DigitalOcean is a great platform to create a virtual private server. DigitalOcean provides varieties of operating system which are operatable its virtual servers. Operating systems like Ubuntu, Fedora, Centos, Debian, FreeBSD, etc. Creating a droplet will allow its users to create projects and host their websites among different platforms.
Being an official partner of DigitalOcean, Cloudlaya provides you excellent VPS hosting in DigitalOcean at prices which are very low as compared to other unofficial service providers. You can choose Cloudlaya as your service provider and get freed from all these processes. In www.cloudlaya.com, we provide you your required project after completing all the processes and after installing your required application. But if you want to know the process of how to create a droplet on DigitalOcean then follow up this article to the end to find out.
Steps to create a droplet on DigitalOcean
- create an account on DigitalOcean, you might be charged some money but it will be worth the service.
- After you successfully create an account then click on the create button and choose Droplet among the dropdown options.
- Then you will be displayed some options to choose from, these options are the operating system you want to install on your server. You can choose different operating systems like Ubuntu, Fedora, Centos, Debian, FreeBSD, etc and you can also choose the version you wish to install. (Full of options!!!)
- Then you are asked to choose a plan, in this process you need to choose the amount of RAM, storage spaces and CPU cores you wish to have on your virtual server. The different plans will cost you a range of money in accordance with the resources you will use.
- Then you need to choose a data center from the given choices, these data centers are distributed among the world you can choose any data centers you like. (not necessarily but sastoname advised you to choose the data center geographically near from you)
- After that, you are asked to choose an additional option of networking. You can choose private networking if your project is private and exclusive but you can choose IPV6 networking if you want your project to be online.
- Then you can choose the authentication process you would like to choose. If you choose a one-time password option then DigitalOcean you email you a root password on your email and you can use that to log in to your server. You can also choose the ssh keys authentication process, which is a more secure and technical process than a one-time password process. If you are new to ssh then you can choose a one-time password process.
- Now we are in the finalizing process, here you are asked to choose a name and number for your droplet. You can also create multiple droplets with the same configuration. You can also create backup for your droplet but it is going to cost you some extra money. (10% of Droplet)
- Then click on create Droplet. well congratulations, you just created a droplet on DigitalOcean.
That was the process you need to follow to create a droplet on DigitalOcean but that is just a part of a process. What we have just done is created a platform for our server now we need to install the required applications. Generally, LAMP package is installed on these types of servers.
AMP is actually an acronym which represents the Linux operating system, with the Apache webserver. The site data is stored in a MySQL database, and dynamic content is processed by PHP. in order to install these applications on virtual server from your computer at your home you will need to use the terminal applications on your computer, we recommend you to use an amazing application called PuTTY. After installing PuTTY, you can connect to the server using its public IP address. After connecting and logging in into the server using the login credentials sent via Email, you will need to perform basic configuration on the server.
Initial Server Setup with Ubuntu
When you first create a new Ubuntu 18.04 server, there are a few configuration steps that you should take early on as part of the basic setup. This will increase the security and usability of your server and will give you a solid foundation for subsequent actions.
Step 1: Login as root
To login to your server, you will need your server’s IP address and login credentials. When you have the required credentials open your PuTTY application’s terminal and type in the following codes. (replace the highlighted part with your server’s IP address.)
$ ssh root@your_server_ip
Accept the warning about host authenticity if it appears. If you are using password authentication, provide your root password to log in. If you are using an SSH key that is passphrase protected, you may be prompted to enter the passphrase the first time you use the key each session. If this is your first time logging into the server with a password, you may also be prompted to change the root password.
Step 2: Creating a New User
From here we will create a user that we will use to log in from next time. Creating a new user is pretty easy, just type in the following codes.
You can put your own name instead of Sammy i.e. Sammy is a username. Then hit enter then you will as be asked to type in the password you will use to access the account. And then fill up the other remaining fields if you like as they are optional and can be skipped.
Step 3: Granting Administrative Privilege
You will need to grant this user administrative privilege if you want to install different applications from this account. After granting administrative privilege the user will be able to perform root commands by simply putting “sudo” before each command. As a root user run these commands to add your normal user to sudo group.
#usermod -aG sudo Sammy
Step 4: Setting up a basic firewall
You can simply deploy firewall by typing in these commands:
Then type Y and the enter.
This completes the initial server setup in ubuntu server. Now let’s learn about the installation of LAMP packages as it was necessary to initially set up the server in order to install LAMP packages. To install these applications, we need to follow these steps.
Step 1: Installing Apache and updating firewall
The Apache web server is among the most popular web servers in the world. It’s well-documented and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website.
Install apache using these commands:
$ sudo apt update $ sudo apt install apache2
Press Y and hit enter to proceed with the installation, the installation will proceed. After completing this process be sure to adjust your firewall to allow web traffic into the Apache server. You can allow HTTP and HTTPS web traffic for apache using this command
$ sudo ufw allow in “Apache Full”
You can check this right away by visiting your server’s IP address.
*remember these commands are case sensitive so be careful while typing.
Step 2: Installing MySQL
Currently, you have your web server up and running now you will need to install MySQL database. MySQL is a database management tools currently being used by most organizations. It will organize the data you stored and provide access from anywhere. You can use apt to acquire and install the required software.
$ sudo apt install mysql-server
This process will install the MySQL server into your virtual server.
When the installation is complete, run a simple security script that comes pre-installed with MySQL which will remove some dangerous defaults and lock down access to your database system. Start the interactive script by running:
$ sudo mysql_secure_installation
This will ask if you want to configure the VALIDATE PASSWORD PLUGIN.
Y for yes, or anything else to continue without enabling.
VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No:
If you answer “yes”, you’ll be asked to select a level of password validation. Keep in mind that if you enter
2 for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words.
There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Regardless of whether you chose to set up the
VALIDATE PASSWORD PLUGIN, your server will next ask you to select and confirm a password for the MySQL root user. This is an administrative account in MySQL that has increased privileges. Think of it as being similar to the root account for the server itself (although the one you are configuring now is a MySQL-specific account). Make sure this is a strong, unique password, and do not leave it blank.
If you enabled password validation, you’ll be shown the password strength for the root password you just entered and your server will ask if you want to change that password. If you are happy with your current password, enter
N for “no” at the prompt:
Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
For the rest of the questions, press
Y and hit the
ENTER key at each prompt. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes you have made.
Note that in Ubuntu systems running MySQL 5.7 (and later versions), the root MySQL user is set to authenticate using the
auth_socket plugin by default rather than with a password. This allows for some greater security and usability in many cases, but it can also complicate things when you need to allow an external program (e.g., phpMyAdmin) to access the user.
If you prefer to use a password when connecting to MySQL as root, you will need to switch its authentication method from
mysql_native_password. To do this, open up the MySQL prompt from your terminal:
Next, check which authentication method each of your MySQL user accounts use with the following command:
mysql>SELECT user,authentication_string,plugin,host FROM mysql.user;
In this example, you can see that the root user does in fact authenticate using the
auth_socket plugin. To configure the root account to authenticate with a password, run the following
ALTER USER command. Be sure to change
password to a strong password of your choosing:
sql>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES which tells the server to reload the grant tables and put your new changes into effect:
Check the authentication methods employed by each of your users again to confirm that root no longer authenticates using the
sql>SELECT user,authentication_string,plugin,host FROM mysql.user;
You can see in this example output that the root MySQL user now authenticates using a password. Once you confirm this on your own server, you can exit the MySQL shell
At this point, your database system is now set up and you can move on to installing PHP, the final component of the LAMP stack.Step 3: Install PHP
PHP is the component of your setup that will process code to display dynamic content. It can run scripts, connect to your MySQL databases to get information, and hand the processed content over to your webserver to display.
$ sudo apt install php libapache2-mod-php php-mysql
This command will install PHP without any problem.
This completes our article for the basic setup and installation of the LAMP package on DigitalOcean. Well, this is a pretty long process and can be hard for peoples new to the system so to avoid all these technical processes you can save time and money by choosing Cloudlaya as we provide amazing packages at a low price. So, while looking for the best Webhosting and email hosting service provider in Nepal, you know who to call.😉