Tumgik
root-bash-blog · 5 years
Text
Magento 2 in Ubuntu
Joomla, Drupal, Wordpress, Magneto CE, and other PHP based Information System Installation in the Ubuntu.
--------------------------------------------------------------------
Install and Configure apache2
--------------------------------------------------------------------
# apt update
# apt install apache2
# systemctl stop apache2.service
# systemctl start apache2.service
# systemctl enable apache2.service
--------------------------------------------------------------------
Install and Configure the database (MySql or MariaDB)
--------------------------------------------------------------------
# apt-get install mariadb-server mariadb-client -y
# systemctl start mariadb.service
# systemctl enable mariadb.service
# systemctl stop mariadb.service
        -----------------------------------------------------------
        Create Database in the MySql or MariaDB server.
        -----------------------------------------------------------
# mysql -u root -p
mysql> CREATE DATABASE (DATABASE NAME);
mysql> CREATE USER 'USERNAME'@' web_server_IP' IDENTIFIED BY 'PASSWORD';
mysql> GRANT ALL ON DATABASE NAME.* TO ' USERNAME '@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'WEB_SERVER_USER'@'WEB_SERVER_IP';
mysql> FLUSH PRIVILEGES;
mysql> SET GLOBAL innodb_file_format = barracuda;
mysql> SET GLOBAL innodb_file_per_table = 1;
mysql> SET GLOBAL innodb_large_prefix = 'on';
mysql> EXIT;
--------------------------------------------------------------------
To change the MySql or MariaDB password use this line.
--------------------------------------------------------------------
# mysql_secure_installation
--------------------------------------------------------------------
Install the PHP and its extension  
--------------------------------------------------------------------
# apt-get install software-properties-common -y
# add-apt-repository ppa:ondrej/php -y
# apt update -y
# apt install php -y
# apt install libapache2-mod-php -y
# apt install php-common -y
# apt install php-gmp -y
# apt install php-curl -y
# apt install php-soap -y
# apt install php-bcmath -y
# apt install php-intl -y
# apt install php-mbstring -y
# apt install php-xmlrpc -y
            Note: In Ubuntu 18.04, We have to use  
# apt install php7.1-mcrypt -y
            Note: In Ubuntu 16.04, We have to use  
# apt install php-mcrypt -y          
# apt install php-mysql -y
# apt install php-gd -y
# apt install php-xml -y
# apt install php-cli -y
# apt install php-zip -y
# apt install zip -y
# apt install upzip -y
# apt install curl -y
# apt install git -y
--------------------------------------------------------------------
Edit the php.ini file in the etc directory
--------------------------------------------------------------------
# nano /etc/php/7.1/apache2/php.ini
             Note: Update these lines in the file.
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 2G
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
             Note: Unchecked  all the extension lines in the file
--------------------------------------------------------------------
Create php information file in the root directory
--------------------------------------------------------------------
# systemctl restart apache2.service
# nano /var/www/html/phpinfo.php
// php information file creator
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
--------------------------------------------------------------------
Edit the apache configuration file in the etc directory.
--------------------------------------------------------------------
# nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/FOLDER NAME/
    ServerName example.com
    ServerAlias www.example.com
    <Directory /var/www/html/FOLDER NAME/>
       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>
--------------------------------------------------------------------
Download the CMS and install in the Root Directory
--------------------------------------------------------------------
// Here, we are going to install Magento 2
// Here, we are going to download Magento 2 from github download
# cd /var/www/html/
# cd /var/www/html
# curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# cd /var/www/html
# composer create-project --repository=https://repo.magento.com/ magento/project-community-edition (FOLDER NAME)
--------------------------------------------------------------------
For downloading the Magento 2, we will have to generate a set of public and private key in the Magento stie.
--------------------------------------------------------------------
Public Key 060f1460c97de693f3de3a8525db0ae8
Private Key b5c35b486038e871d5baca9fb326988e
# chmod 777 -R /var/www/html/
# chown -R www-data:www-data /var/www/html/FOLDER NAME /
# chmod -R 777 /var/www/html/FOLDER NAME/
# a2ensite magento2.conf
# a2enmod rewrite
# systemctl restart apache2.service
# chmod 777 -R /var/www/html/  // Most Important command in the installation
--------------------------------------------------------------------
After installation command
--------------------------------------------------------------------
# cd /var/www/html/magento2
# bin/magento maintenance:enable
# php bin/magento indexer:reindex
# php bin/magento cron:install
# php bin/magento maintenance:disable
# php bin/magento setup:store-config:set --base-url="http://www.cellon.com/ma/"
--------------------------------------------------------------------
Magento Update command
--------------------------------------------------------------------
# composer require magento/product-community-edition 2.3.0 --no-update
# composer update
# php bin/magento setup:upgrade
# php bin/magento setup:di:compile
1 note · View note