Installing Magento 2.2.3 Community Edition on Ubuntu

This post assumes you already have Ubuntu installed and is functioning properly.

In terminal:

Install Web server

sudo apt-get install apache2
sudo systemctl restart apache2
sudo systemctl enable apache2.service
sudo apt-get install mysql-server mysql-client
sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

 Enter password for root user: Enter Root Password
Change the password for root: N
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: N
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
sudo mysql -u root -p
CREATE DATABASE magentodb; GRANT ALL ON magentodb.* TO \'magentouser\'@\'localhost\' IDENTIFIED BY \'type_new_password_here\';
FLUSH PRIVILEGES;
exit;

If you receive an error try to use lower case letters.

sudo apt-get install php php-fpm libapache2-mod-php php-mysql php-curl php-mcrypt php-xml php-dom php-intl php-mbstring php-zip php-gd

Download Magento 2.2.3 CE

wget http://marwanshamaa.com/wp-content/uploads/2018/04/Magento-223.tar.gz
sudo tar -zxvf Magento-223.tar.gz -C /var/www/html/
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
sudo rm /var/www/html/index.html

Update Apache default site configuration file.

sudo nano /etc/apache2/sites-available/000-default.conf

Add highlighted lines, then save the file.

# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request\'s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory># Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warnErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with \"a2disconf\".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

sudo a2enmod rewrite

sudo systemctl restart apache2

http://localhost/setup/

Don\’t forget to setup the cron jobs.

There are three main cron jobs, the first command (magento cron:run) reindexes indexers, sends automated e-mails, generates the sitemap, and so on. Usually it’s associated with the PHP command line .ini file. The other two commands are used by the Component Manager and System Upgrade.

Assuming the PHP binary is located in /usr/bin, you installed Magento in /var/www/magento2, use crontab:

sudo crontab -u magentouser -e

* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v \”Ran jobs by schedule\” >> /var/www/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log

Command line to find your PHP path is here

Cron jobs can be managed from Web Setup Wizard – Refer to my crontab post to learn and adjust the \”* * * * *\” based on your needs and site traffic.

Scroll to Top