sudo apt-get install apache2 sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf sudo systemctl stop apache2.service sudo systemctl start apache2.service sudo systemctl enable apache2.service
sudo apt-get install mariadb-server mariadb-client sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
Enter current password for root (enter for none): Just press the Enter Set root password? [Y/n]: Y New password: Enter password Re-enter new password: Repeat password Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Restart MariaDB server
sudo systemctl restart mariadb.service
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt update sudo apt-get install php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-bcmath php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl
sudo mysql -u root -p CREATE DATABASE magento; CREATE USER 'magentouser'@'localhost' IDENTIFIED BY 'new_password_here'; GRANT ALL ON magento.* TO 'magentouser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
sudo mkdir /var/www/html/magento/ sudo tar -zxvf ~/Downloads/Magento-CE*.tar.gz -C /var/www/html/magento/ sudo chown -R www-data:www-data /var/www/html/magento sudo chmod -R 755 /var/www/html/magento
sudo nano /etc/apache2/sites-available/magento.conf
copy and paste the content below into the file and save it. Replace the highlighted line with your own domain name and directory root location.
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/magento/
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/html/magento/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite magento.conf sudo a2enmod rewrite sudo systemctl restart apache2.service
Then open your browser and browse to the server domain name. You should see Magento setup wizard to complete. Please follow the wizard carefully. See: https://websiteforstudents.com/setup-magento-on-ubuntu-18-04-lts-beta-with-apache2-mariadb-and-php-7-1-support/