×
Community Blog How to Install FarmOS on Alibaba Cloud

How to Install FarmOS on Alibaba Cloud

In this tutorial, we will be installing and setting up Selfoss RSS Reader on an Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.

By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

FarmOS is an open source web-based application that is aimed for the agricultural industry, providing features such as farm management, planning, and record keeping.

In this tutorial, we will be installing and setting up Farm OS on an Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.

Prerequisites

  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get $300 – $1200 worth in Alibaba Cloud credits for your new account. If you don't knowa about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS's IP address
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  • Set up your server's hostname and create user with root privileges.

Setting Up Your Server

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges.

# sudo apt update && sudo apt upgrade

Install PHP

FarmOS requires installation of PHP 5.5 or newer version of PHP. But it is recommended to use PHP 7.2. Hence, in this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.

First, you will need to install python software properties and software properties common. To do so, execute the command below.

# sudo apt-get install software-properties-common python-software-properties 

You will need to add repository for newer versions of PHP. To do so, execute the commands below.

# sudo add-apt-repository ppa:ondrej/php

Update the system to refresh the available repositories. To do so, execute the command for updating Ubuntu system.

# sudo apt update

Install PHP 7.2. To install PHP 7.2, execute the following command.

# sudo apt install -y php7.2

FarmOS requires the following PHP extensions:

  1. php7.2-gd
  2. php7.2-xml
  3. php7.2-xmlrpc
  4. php7.2-mysql
  5. php7.2-mbstring

To install the above extensions of PHP, execute the following command.

# sudo apt-get -y install php-gd php-xml php-xmlrpc php-mysql php-mbstring

When you have done installation of the above extensions, apache2 will be installed automatically.

To check your PHP installation, you can execute the following command to check installed PHP version.

# php --version

Install MariaDB

FarmOS supports MySQL, SQLite and PostgreSQL. In this tutorial, you will use MariaDB server for MySQL. By default, Ubuntu repository has older version of MariaDB server. To use new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.

Verify the keys by executing command.

# sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Add the repository using the command.

# sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu xenial main'

Update the system by using command.

# sudo apt update

Install MariaDB using the following command.

# sudo apt install -y mariadb-server

Start and enable the MariaDB server so that the server can start automatically after reboot.

# sudo systemctl start mariadb
# sudo systemctl enable mariadb

Run the following command to enhance security of MariaDB server and set password for the root user.

# sudo mysql_secure_installation

connect to the MySQL shell as root user using the command below and enter your password.

# sudo mysql -u root -p

Execute the following MySQL queries in your MariaDB server.

CREATE DATABASE farmdb CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'aareez'@'localhost' IDENTIFIED BY '654321Ab';
GRANT ALL PRIVILEGES ON farmdb.* TO 'aareez'@'localhost';
FLUSH PRIVILEGES;
EXIT; 

Install FarmOS

To install FarmOS, you will need to follow the steps.

Navigate to /var/www/html using the command.

# cd /var/www/html

Download the latest stable release of FarmOS using the command below.

# sudo wget https://ftp.drupal.org/files/projects/farm-7.x-1.0-beta15-core.tar.gz  

Remove index.html file using the command below.

# sudo rm index.html

De-package the downloaded directory farm-7.x-1.0-beta15-core.tar.gz

# sudo tar -zxvf farm-7.x-1.0-beta15-core.tar.gz

Remove farm-7.x-1.0-beta15-core.tar.gz using the command below.

# sudo rm farm-7.x-1.0-beta15-core.tar.gz

Rename your extracted folder.

# sudo mv /var/www/html/farm-7.x-1.0-beta15 /var/www/html/farmos

Provide ownership of /var/www/ to www-data so that apache server can access the required files.

# sudo chown -R www-data:www-data /var/www/html/farmos

Set permissions for sites/default/settings.php and sites/default using the commands below.

# cd /var/www/html/farmos
# sudo chmod 777 ./sites/default
# sudo cp ./sites/default/default.settings.php ./sites/default/settings.php
# sudo chmod 777 ./sites/default/settings.php

Configure Apache Server

Create a virtual host configuration file for FarmOS. Execute the following command, a file will be opened in nano text editor.

# sudo nano /etc/apache2/sites-available/farmos.conf

Copy and FarmOS the following code and save the file.

<VirtualHost *:80> 
    ServerAdmin admin@xyz.com
    ServerName softpedia.xyz
    DocumentRoot /var/www/html/farmos
    DirectoryIndex index.php index.htm index.html
   <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
 ErrorLog ${APACHE_LOG_DIR}/farm_error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/farm_access.log combined
</VirtualHost>

Execute the command below to disable default site.

# sudo a2dissite 000-default.conf

Enable the newly created virtual host. To do so, execute the command below.

# sudo a2ensite farmos

You will need to enable rewrite mod. You can do so by editing configuration file in apache2 directory or you can simply execute the command below.

# sudo a2enmod rewrite

Enable SSL engine. You can do so by editing configuration file in apache2 directory or you can simply execute the command below.

# sudo a2enmod ssl

Restart apache server to apply the changes and load the settings by executing command below.

# sudo service apache2 restart

Configure FarmOS

You can access FarmOS via your domain name or ECS IP address. In my case, I have accessed via http://www.softpedia.xyz . Remember to prefix www in URL. You will see the following screen.

1

Click save and continue to continue. You will be redirected to database configuration page. Fill the form to configure your database and click save and continue.

2

Add site information as shown below.

3

Setup administrator account to access your FarmOS

4

Select your country and your time zone as shown below then click save and continue.

5

Select your desired modules and click continue.

6

You will see the following screen.

7

When you will visit your site, after login, you will see the dashboard of FarmOS.

8

Install SSL Certificate

To install SSL certificate using Let's Encrypt SSL, follow the steps below.

Update your system by executing command below.

# sudo apt-get update

To install software-properties-common, execute the command below.

# sudo apt-get install software-properties-common

Add the certbot repository by using command below.

# sudo add-apt-repository ppa:certbot/certbot

Update the package to load the added certbot repository using command.

# sudo apt-get update

Stop apache before issuance of SSL certificate.

# sudo systemctl stop apache2

Install python-certbot-apache using the command below.

# sudo apt-get install python-certbot-apache

Execute the following command to get encrypt SSL issued.

# sudo certbot --apache -d softpedia.xyz

Select the option 2 to redirect the link to https and update virtual host settings for SSL.

After successful issuance of SSL, restart apache server.

# sudo systemctl start apache2

Set Up Firewalls and Ports

If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you have forgotten to unblock these ports, you can follow the procedure in this guide: https://www.alibabacloud.com/help/doc-detail/25471.htm

That's it! You have successfully installed and configured FarmOS on your server.

0 0 0
Share on

Alibaba Clouder

2,605 posts | 747 followers

You may also like

Comments