How to Install CouchCMS on Ubuntu 16.04 — Part 2 Installing CouchCMS

Configure Domain

If you bought your domain from Alibaba Cloud, it will automatically setup DNS records. You will only require to add domain to Alibaba Cloud DNS. In case, if you have already registered domain from any other registrar, you will need to add that domain in Alibaba Cloud DNS and update its nameserver records on your registrar account. Once your DNS records are propagated, check them from

  1. Login to your Alibaba Cloud account and click on Alibaba Cloud DNS (available in left sidebar of your dashboard). Click Add Domain Name.
  2. You will see a popup form. Now, type your complete domain name with TLD (in my case and click Confirm.
  3. Now your domain has been added to Alibaba Cloud DNS. You need to configure our domain. Click on Configure, right below the Add Domain Name button.
  4. If you bought domain from Alibaba Cloud, your all nameservers would be configured already. If you bought it from some other registrar, Alibaba Cloud DNS configuration page will detect it and provide your information for changing nameservers.
  1. Now add A record and its value will be the IP address of your ECS instance as shown below.
  1. You can skip this step, if you have bought domain from Alibaba Cloud. If you have bought domain from a third party, you will need to visit the domain registrar’s website. The steps differ according to the registrar.
  2. Now go back to Alibaba Cloud DNS page and click Add Record button to add records, after adding save them. To get records details, you can use

Create Virtual Host

  1. Once your nameservers are updated, you can setup virtual host to point your domain on your Alibaba Cloud ECS IP Address. To setup virtual host on your ECS, execute the following command. Replace with your domain name.
  2. # sudo nano /etc/apache2/sites-available/
  3. Write or copy & paste the following text in opened file. Replace and with your own domain name and with your email address.
  • <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin ServerName ServerAlias # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/html/ # Log file locations LogLevel warn ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost>
  1. After adding the text, use Ctrl + X, then press ‘Y’, then hit Enter key to save the file.
  2. Now restart your Apache Server to load the changes by using the following command
  3. # sudo systemctl restart apache2
  4. After setting up virtual host, you can access your website by accessing your domain. In my case, I used to access my website.
  5. Note: The above configurations of virtual host are for HTTP protocol. To setup HTTPS protocol, you will have to install SSL. To install SSL and allow HTTPS to provide a secured experience to your users, you will need to install Let’s Encrypt. Let’s Encrypt will provide you free SSL for your domain.

Install Git

  1. To begin installation of Let’s Encrypt from GitHub repository, you will need to install Git. Execute the following command to install Git.
  2. # sudo apt-get install git
  3. You will be asked “Do you want to continue?”, type ‘y’ and hit Enter key.

Configure Let’s Encrypt SSL

  1. For installation of Let’s Encrypt SSL, you will have to stop your Apache Server. Use the command below to stop apache server. Remember, Certbot uses port 80 to get SSL certificate. Apache server uses same port 80. So, to avoid conflict, Apache server must be stopped until you get SSL certificate issued.
  2. # sudo systemctl stop apache2
  3. To install add-apt-repository command, install software-properties-common. To do so, execute the following command:
  4. #sudo apt-get install -y software-properties-common
  5. Now add the required repository to install client for Let’s Encrypt SSL certificates. To do so, execute the following command.
  6. # sudo add-apt-repository ppa:certbot/certbot
  7. You will be prompted to press Enter key to continue this process.
  8. Now you will need to update your package list by executing the command below to get the new repository’s information.
  9. # sudo apt-get update
  10. Now execute the following command to install Certbot.
  11. # sudo apt-get install python-certbot-apache
  12. You will be prompted whether you want to continue or not. Type ‘Y’ and hit Enter key.
  13. Now create your SSL certificate. Let’s Encrypt performs challenges for Domain Validation on the basis of which Certificate Authority (CA) will authenticate your domain. On validation, you will be issued a SSL certificate by CA. To create SSL certificate for your domain using Let’s Encrypt, use the following command:
  14. # sudo certbot --apache -d -d
  15. Note: Remember to replace with your own domain name.
  16. Now you will be prompted to write your email address. Type your email and hit Enter.
  17. You will be asked to agree with terms. Type A and hit Enter key to proceed.
  18. You will be prompted to select vhost number. In my case, it is 2 for
  19. Type 2 and hit Enter.
  1. You will be asked whether you would like to redirect all traffic to https version or not. Choose any option from 1 or 2 according to your choice. I have chosen 2 because I want to redirect all my traffic to https version of my website.
  2. Now when you will have to setup virtual host again to make it compatible with HTTPS. You will also want to stop people accessing your website without SSL. For this purpose, you may force SSL and every user will be redirected to secured website via HTTPS. For this purpose, execute the command below:
  3. # sudo nano /etc/apache2/sites-available/
  4. After executing the above command, a file will be opened. Copy the text below to this opened file.
  • <IfModule mod_ssl.c> <VirtualHost *:443> ServerName ServerAdmin ServerAlias SSLEngine on SSLCertificateFile /etc/letsencrypt/live/ SSLCertificateKeyFile /etc/letsencrypt/live/ SSLCertificateChainFile /etc/letsencrypt/live/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/ # Log file locations LogLevel warn ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost> </IfModule> <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin ServerName ServerAlias Redirect permanent / # Log file locations LogLevel warn ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost>
  1. Replace with your domain name. This above code will force SSL and all of the traffic will be redirected to HTTPS version of the website.

Create Database

  1. Use MySQL shell to login as root user and execute the following command:
  2. # sudo mysql -u root -p
  3. Now the command prompt will ask you to enter password for user ‘root’. Enter the password and hit enter key, you will be prompted to MySQL command prompt.
  4. To create the database and user for this database for your Couch CMS, use the following query:
  • CREATE DATABASE co_db CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'co_db'@'localhost' IDENTIFIED BY 'Password'; GRANT ALL PRIVILEGES ON co_db.* TO 'co_db'@'localhost'; FLUSH PRIVILEGES; EXIT;
  1. where co_db can be changed to your desired name.

Install Couch CMS Files

  1. First of all, disable default Apache virtual host by executing the following command:
  2. # sudo a2dissite *default
  3. Now enable your website by executing the following command.
  4. # sudo a2ensite
  5. Execute the following command to reload your apache server, otherwise, your domain will keep showing default page of apache host.
  6. # sudo service apache2 restart
  7. To begin installation of Couch CMS, navigate to directory cd /var/www/html/because in Apache Server, we use this as web-directory.
  8. Note: In case, if you get any error like ‘No such directory or file’, then create htmldirectory. To do so, navigate to cd /var/www and execute the following command to create html directory and type cd html and hit enter.
  9. # sudo mkdir html
  10. Now use the following command to get Couch CMS package for installation. The following command will fetch the latest version of Couch CMS from its official website.
  11. # sudo wget -O
  12. Now you will have to list the files in the directory to see files & folders. To list the files in current directory, use the command:
  13. # ls -la
  1. Downloaded Couch CMS is saved in compressed form as Now you will have to unzip the compressed zip folder as listed when executed ls -la command. To do so, use the command:
  2. # sudo unzip
  3. Now use the following command to move files from extracted folder to your root directory.
  4. # sudo mv ./CouchCMS-2.0/* /var/www/html
  5. Change the owner of files to avoid permissions issues. This will allow apache to access files of CMS without any issue. Execute command below:
  6. # sudo chown -R www-data:www-data html
  7. After performing the above steps, restart Apache to reload the latest configurations using the command:
  8. # sudo systemctl restart apache2
  9. Now you will have to database configuration for Couch CMS installation. For this purpose, you will need to edit config.php file. Use the following command to change config.example.php to config.php
  10. # sudo mv ./couch/config.example.php ./couch/config.php
  11. Now open config.php file in nano editor and add the following text then use Ctrl+X, then press ‘Y’ and then hit Enter key to save the changes. Use the following command to open file.
  12. # sudo nano /var/www/html/couch/config.php
  • define( 'K_GMT_OFFSET', 0 ); define( 'K_DB_NAME', 'co_db' ); define( 'K_DB_USER', 'co_db' ); define( 'K_DB_PASSWORD', 'Password' ); define( 'K_DB_HOST', 'localhost' ); define( 'K_PRETTY_URLS', 1 ); define( 'K_USE_CACHE', 1 ); define( 'K_EMAIL_TO', '' ); define( 'K_EMAIL_FROM', '' );

Accessing CouchCMS

Congratulations! Now it’s time to access your CouchCMS. Just open website in your browser. In my case, I will open Now we will proceed towards completion of installation of Couch CMS which will involve different settings.

Complete the Installation of Couch CMS

  1. Enter details for Super Admin. Select email, password and username of your choice. Then click Install button to proceed further.
  1. In the next step, you will be redirected to the screen as shown below. Click on log in.
  1. In the next step, you will have to enter your username and password and then click Login.
  2. This is how your admin panel will look like after login.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: