<\/span><\/h2>\r\n\r\n\r\n\r\nFirst, you need to login to your server via SSH as user root:<\/p>\r\n\r\n\r\n\r\n
ssh root@IP_ADDRESS -p PORT_NUMBER<\/pre>\r\n\r\n\r\n\r\nmake sure that you replace \u201cIP_ADDRESS\u201d and \u201cPORT_NUMBER\u201d with your actual server IP address and SSH port number.<\/p>\r\n\r\n\r\n\r\n
After you log in, let’s make sure that your Ubuntu 16.04 server is up-to-date by running the following commands:<\/p>\r\n\r\n\r\n\r\n
apt-get update\r\napt-get upgrade<\/pre>\r\n\r\n\r\n\r\n<\/span>2. Install Apache<\/span><\/h2>\r\n\r\n\r\n\r\nRun the following command to install Apache on your server:<\/p>\r\n\r\n\r\n\r\n
apt-get install apache2<\/pre>\r\n\r\n\r\n\r\nAfter the installation is completed, you can enable the service to be started automatically upon system boot with:<\/p>\r\n\r\n\r\n\r\n
systemctl enable apache2<\/pre>\r\n\r\n\r\n\r\nYou can verify if the Apache server is running, with the following command:<\/p>\r\n\r\n\r\n\r\n
systemctl status apache2<\/pre>\r\n\r\n\r\n\r\n<\/span>3. Install PHP 7.0<\/span><\/h2>\r\n\r\n\r\n\r\nTo install PHP 7 along with all the additional modules required by NextCloud, run the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install php7.0 libapache2-mod-php7.0 php7.0-common php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip<\/pre>\r\n\r\n\r\n\r\n<\/span>4. Install MySQL Database server and create a database<\/span><\/h2>\r\n\r\n\r\n\r\nNext, we need to install the MySQL database server. To do this, simply run the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install mysql-server<\/pre>\r\n\r\n\r\n\r\nYou can now start the database server and enable it to automatically start upon boot, with the following commands::<\/p>\r\n\r\n\r\n\r\n
systemctl start mysql\r\nsystemctl enable mysql<\/pre>\r\n\r\n\r\n\r\nYou can also run the mysql_secure_installation<\/strong> script to harden the security of your MySQL database server:<\/p>\r\n\r\n\r\n\r\nmysql_secure_installation<\/pre>\r\n\r\n\r\n\r\nAfter you have answered all the questions you can now go ahead and login to MySQL as root using your root password, with the following command:<\/p>\r\n\r\n\r\n\r\n
mysql -u root -p<\/pre>\r\n\r\n\r\n\r\nTo create a new database for your NextCloud installation, run the following commands:<\/p>\r\n\r\n\r\n\r\n
CREATE DATABASE nextcloud_db;\r\nGRANT ALL PRIVILEGES ON nextcloud_db.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY 'PASSWORD';\r\nFLUSH PRIVILEGES;\r\nexit;<\/pre>\r\n\r\n\r\n\r\nMake sure to replace \u201cPASSWORD\u201d with an actual, strong password.<\/p>\r\n\r\n\r\n\r\n