Tag Archives: CentOS

Install NginX CentOS From Source

Update the repository

yum update -y

Install the EPEL repository

yum install epel-release -y

Install dependencies from yum

yum install -y zlib zlib-devel pcre prce-devel openssl openssl-devel

Get the Nginx packages to install

cd /usr/src
wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar xvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

Create user nginx

useradd -d /etc/nginx/ -s /sbin/nologin nginx

Configure

./configure --user=nginx --group=nginx --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_realip_module --without-http_scgi_module --without-http_uwsgi_module --with-http_realip_module

Compile and Install

make
make install

Verify NginX is installed

nginx -v

Add systemd service file

vi /etc/systemd/system/nginx.service

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Enable and start service

systemctl enable nginx
systemctl start nginx

Check nginx is processing your request

On commandline

curl localhost

Browser

Make sure port 80 is enabled.

firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --reload

Findout the ip

ip addr

Load the site using the URL and it should display ‘Welcome to nginx!’ message.

http://127.0.0.1/

 

Install OpenSSL CentOS Linux

OpenSSL – Supports the HTTPS protocol. Required by the NGINX SSL module and others.

Run the following commands to install openssl

cd /tmp/
wget http://www.openssl.org/source/openssl-1.0.2o.tar.gz
tar -zxf openssl-1.0.2o.tar.gz
cd openssl-1.0.2o
./Configure linux-x86_64 --prefix=/usr 
make
make install

You can verify the installation by issuing the following command.

openssl -version

Install Magento 2 Commandline Linux CentOS

Follow the below steps to install Magento 2 with sample-data.

Make sure that httpd / Nginx,PHP,MySQL and Composer are installed in the server by issuing the following commands

httpd -v / nginx -v
php -v
composer -v
mysql

Change the directory to documet root

cd /var/www/html/

Download Magento and issue the following commands

sudo git clone https://github.com/magento/magento2.git

cd magento2

sudo git checkout tags/2.2.1 -b 2.2.1

chown -R httpd:www /var/www/html/magento2/

sudo chmod -R 775 /var/www/html/magento2/

chmod 777 var/ generated/ app/etc/ pub/

composer install

composer update

composer config repositories.0 composer https://repo.magento.com

php bin/magento setup:install --base-url=http://127.0.0.1/magento2/ --backend-frontname=admin \
--db-host=127.0.0.1 --db-name=mage2 --db-user=root --db-password=Root@123 \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
--admin-user=admin --admin-password=admin17 --language=en_US \
--currency=USD --timezone=America/Chicago --use-rewrites=1

php bin/magento sampledata:deploy

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

Now check the site http://127.0.0.1/magento2/ .

Install MySQL Linux CentOS

Download Package

yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm -y

Install MySQL

yum install mysql-community-server -y

Start MySQL

service mysqld start
service mysqld status

Generate Temporary password

grep 'temporary password' /var/log/mysqld.log

Login To MySQL

mysql -uroot -p

Reset Password and set Privilages

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root@123';

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Root@123' WITH GRANT OPTION;

FLUSH PRIVILEGES;

Open MySQL Port 3306

firewall-cmd --zone=public --add-port=3306/tcp --permanent

firewall-cmd --reload

firewall-cmd --list-all