Why DigitalOcean?

Considering making the leap to install Cockpit CMS on DigitalOcean directly? As DigitalOcean is the biggest provider of cloud hosting services, it makes sense to consider trying it out.

Knowing how to install CockpitCMS on DO involves a bit more work than with other hosting providers like Cloudways. However, cloud hosting is quickly becoming standard for all businesses. This means knowing how to navigate DigitalOcean will benefit you and your website.

If you are a blogger, web developer, or someone with mission-critical hosting requirements, you can’t put your confidence in cheap and/or untrustworthy web hosting providers. Digital Ocean provides you affordable cloud droplets with full root access to install your desired application on. They are also developing a tool to install Cockpit CMS, but you have to run multiple commands and install various packages.

DigitalOcean maintains 12 data centers worldwide, and you should probably choose the one closest to your initial target audience. You can always set up a global network when the demand grows. DigitalOcean offers private virtual Linux OS-powered machines called ‘droplets.’

Why DigitalOcean With Cloudways?

Cloud hosting is great, but it also requires managing, setting up, and securing your cloud servers. It’s extraordinary in case you know how to do it, but if you lack the specialized ability required to set up a cloud framework for your site, you’ll need to enlist a managed provider to do all the hard work for you. 

One thing you should know, deploying applications on DO is a complicated, long, and tiring process. You will have to go through tons of documentation to understand how their system works. To make this process easier, I’d recommend using managed hosting.

Cloudways offers managed cloud hosting solutions, Cloudways takes care of all your server management. You’ll be able use the control of cloud hosting without needing to stress about the details of server setup and security.

Create and Launch DigitalOcean Droplet

After signing up, you need to create a new droplet by clicking Create > Droplets.

Create and Launch DigitalOcean Droplet

On the Create Droplets section, navigate to the setup screen, you have to configure the server specifications and other settings. The first section is the distribution selection; Select an image. For this tutorial, I will go with Debian 9, which is the Linux OS flavor that you are going to install on my server.

Debian 9

Now, choose the plan. For this tutorial, I will choose the basic plan.

basic plan

Next, choose the server specification you need for your DO droplet. For this example, I’m going to select the lowest plan.

lowest plan

At that point, just take off the Add block storage segment and select a data center region for your DO droplet. It is continuously recommended to select the closest location to your target audience.

data center region

Following this, leave the VPC Network and Select extra alternatives sections. Click the SSH keys under the Authentication section. if you already have an SSH key produced, you’ll be able to choose that, or else you would like to make a new one.

Here, I’ll create an unused SSH key, and for that you simply will be required to PuTTY. I expect that you already have PuTTY.

Open PuTTYgen and click Generate an SSH key.

Generate an SSH key

Copy the complete content from the public key segment and tap Save private key to save your SSH key.

save your SSH key

Go back to your DO server setup and press New SSH Key. Now, paste the text to the SSH key content segment, provide it a title (I selected for Cloudways), and press Include SSH Key.

Add SSH key

Next, choose a hostname for your droplet. I’m naming it Shahzeb-CockpitCMS. 

choose a hostname

Now, leave all the sections because the server setup is complete and all you need to do is Create Droplet.

Create Droplet

It will take a while to set up your droplet.

set up your droplet

If you see the above screen, it means your Droplet was successfully created.

Deploy the LEMP STACK

In order to deploy the LEMP stack, first, you need to open PuTTY and paste your server IP.

server IP

Navigate to Connection > SSH > Auth, click on the browser and then select the PPK file you downloaded from PuTTYgen.

PuTTYgen

Click “Open” to access your DO server droplet and type root.

type root

cd..

Change directory and access the root file.

Change directory

apt update

Update the package lists.

Update the package lists

apt install nginx

To install the NGINX web server.

NGINX web server

And enter “Y” to continue.

apt install mariadb-server

To install the MariaDB database.

MariaDB database

Enter “Y” again to continue.

Mysql_secure_installation

To secure your MariaDB installation

Note: At first, it will ask for the root password and you just have to press “Enter” (By default, there’s no root password).

If you want to set the root password for your database, press “Y” and simply update it.

MariaDB installation

apt install php-fpm php-mysql

To install PHP FPM and MySQL.

PHP FPM and MySQL

nano /etc/nginx/sites-available/default

To edit the default file.

Then add index.php to that line as we are using PHP.

add index.php

Next, uncomment the four lines by removing “#” as shown in the following image and save the file by pressing “ctrl + x”.

uncomment

nano /etc/php/7.0/fpm/php.ini

To edit the php.ini file.

edit the php.ini

Then, press “ctrl+w” and paste “cgi.fix_pathinfo=” with right-click.

cgi.fix_pathinfo

Then, uncomment that line (by removing “;”) and set value “0” like this: cgi.fix_pathinfo= 0;

cgi.fix_pathinfo= 0

Then, exit by pressing “ctrl+x” and save the changes you’ve made.

Now, it’s time to check the configurations for whether or not it’s running. And, now I will create a PHP file and name it shahzeb.php.

nano /var/www/html/shahzeb.php

create a PHP file

Paste the following code into the PHP file and save the changes.

<?php

$name=“Shahzeb Ahmed”;

for ($i=1; $i<=9; $i++)

{

echo “My Name is: “.$name.“<br/>”;

}

?>

Before running the newly created PHP file in the browser, you need to restart NGINX by using the following commands.

systemctl restart nginx

After running the above script, check the PHP file in the browser,

“http://yourIPaddress/shahzeb.php”.

If the newly created PHP file starts executing then it will show my name multiple times, which means you’ve successfully installed the LEMP stack.

successfully installed

Install Cockpit CMS Application

Now, you will have to install your Cockpit CMS application on your DigitalOcean Droplet. So, let’s begin.

To install a Cockpit CMS application, you need to run the followingcommands.

apt install php7.3-common php7.3-mbstring php7.3-xmlrpc php7.3-soap php7.3-gd php7.3-xml php7.3-intl php7.3-ldap php7.3-zip php7.3-curl

Install Cockpit

mysql -u root -p

To access the DB root, run the above command, and use the password that we have previously set up during the MariaDB installation.

CREATE DATABASE CWCC;

Create a new database.

GRANT ALL PRIVILEGES on CWdb.* TO ‘shahzebuser’@’localhost’ IDENTIFIED BY ‘password123’;

Grants full control and permission to a user.

FLUSH PRIVILEGES;

Changes to take effect without restarting the DB service.

effect without restarting the DB service

Then, run the exit command.

exit command

After that, change the directory to html folder.

cd /var/www/html/

Download the latest Cockpit CMS version.

wget https://github.com/agentejo/cockpit/archive/refs/heads/next.zip

Now, unzip the download file with this command.

unzip next.zip

But it will show you the bash command not found.

command not found

First, download the unzip package repository with the following command:

sudo apt-get install unzip

The unzip package repository cache should be downloaded.

unzip package repository

Now, try to unzip the next.zip file using the same command: unzip next.zip

unzip the next.zip

Cockpit CMS files are successfully extracted.

Before running the Cockpit CMS installation process in the browser, navigate to the root directory using cd /  and restart NGINX again by using the following commands.

systemctl restart nginx

To install Cockpit CMS, head to the cockpit-next/install/ file through the address bar. The installation process will take just a while and you’ll see the following screen:

http://159.223.146.49/cockpit-next/install/

install Cockpit CMS

Install Cockpit CMS on Cloudways Managed DigitalOcean Server

You need to Sign Up on Cloudways. You can get started by clicking on the “Get Started For Free” button.

The signup requires a valid email, a GitHub, or a LinkedIn account.

Once you are done, launch a new server with a custom PHP application to install Cockpit CMS on Cloudways.

![Cloudways-installation](https://www.cloudways.com/blog/wp-content/uploads/Cloudways-Installation.gif)

Launch SSH Terminal

Next, Navigate through the server dashboard and click on the Launch SSH Terminal.

Launch SSH Terminal

Once you have accessed the server, move to the public_html folder and simply run the download command to download the Cockpit CMS.

Application > application name > public_html

Install Cockpit CMS

If you thought installing Cockpit CMS is a manual task, here’s a surprise for you – You can install Cockpit CMS by simply typing the following command in the terminal:

wget https://github.com/agentejo/cockpit/archive/refs/heads/next.zip

Along with all the libraries and dependencies required by Cockpit CMS, Everything will now be installed automatically.

You can extract the file Cockpit CMS without installing any Unzip package.

unzip cockpit-next

You can access the webpage by adding cockpit-next/install/ at the end of the URL to open the Cockpit CMS. If you see the page (see below), everything has been configured successfully.

Taking the Website Live

Taking your new Cockpit CMS site live is as easy as launching a server on Cloudways. All you need to do is to head over to your Application Management dashboard and inside the Domain Management tab, add your domain name.

add your domain name

Accessing the DNS management panel can change depending on the chosen service. Still, the method of making a DNS record should not vary much. Here, we’ll utilize the domain “cwdemoapp.com” hosted on Namecheap for demonstration purposes.

DNS record

You just need to update the A and CNAME records to your domain provider, and your Cockpit CMS website would be live in a few seconds.

update the A and CNAME records to your domain provider

Wrapping up!

DigitalOcean is taking cloud hosting to the next level. DigitalOcean is one of the leading cloud hosting providers for Cockpit CMS websites. Its developer-friendly cloud framework gives everything you wish to scale your site with ease. With extensive documentation comprising a devoted page for Cockpit CMS, you may appreciate an instinctive design, user-centric guides, and vigorous features.

As far as technicalities are concerned, we pay attention to that for you. Cloudways guarantees a smooth web experience for the clients. With tons of capable highlights, appreciate our overseen cloud computing administrations at reasonable costs. A devoted team of experts is accessible at your service 24/7. All you have to do is raise a ticket with our support system. With a solid information base and up-to-date web applications, we’ll pay attention to your concerns within no time.