Install Apache, PHP 7.2 and MySQL on CentOS 7 (LAMP)

1. Update and install MySQL / MariaDB


yum -y update
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation

2. Installing Apache, PHP 7.2 and phpMyAdmin


yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum -y update
yum-config-manager --enable remi-php72
yum -y install php php-opcache
systemctl restart httpd.service
yum search php
yum -y install php-mysqlnd php-pdo
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
systemctl restart httpd.service
yum -y install phpMyAdmin
systemctl restart httpd.service

Edit phpMyAdmin.conf

vi /etc/httpd/conf.d/phpMyAdmin.conf


[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
[...]

Change the authentication in phpMyAdmin from cookie to http

vi /etc/phpMyAdmin/config.inc.php


[...]
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
[...]

Restart Apache:


systemctl restart httpd.service

Disable selinux
View Selinux Status:

getenforce

Disable SELinux :

setenforce 0

more about selinux => https://www.amitnepal.com/selinux-tutorial/

Install LAMP on Centos 7


rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation


yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
yum -y install php
systemctl restart httpd.service
yum search php
yum -y install php-mysql
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
systemctl restart httpd.service
yum -y install phpMyAdmin

configure phpMyAdmin. add code :
vi /etc/httpd/conf.d/phpMyAdmin.conf


[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/>
Options none
AllowOverride Limit
Require all granted
</Directory>

[...]

change the authentication in phpMyAdmin from cookie to http:

vi /etc/phpMyAdmin/config.inc.php


[...]
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
[...]

Restart Apache:
systemctl restart httpd.service

Using Tmux (Terminal Multiplexer) to Keep SSH Sessions Running

Tmux is another software which is created to be a replacement for screen. It has most of the capabilities of screen, with few additional capabilities which make it more powerful than screen.

Install tmux

yum -y install tmux

Start a Tmux Session

$ tmux

After performing your operations on the terminal, you can detach that session from the controlling terminal so that it goes into background and you can safely logout.

Detach Tmux Session from Terminal

use the shortcut (Ctrl+b then d)
After this your current session will be detached and you will come back to your terminal from where you can log out safely.

Resuming the Closed Tmux Session

tmux attach

Credit: http://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/

Install VNC on Centos ^

install dekstop
yum -y groupinstall Desktop

install VNC server
yum -y install tigervnc-server

install font
yum -y install xorg-x11-fonts-Type1

chkconfig vncserver on

Set Password
vncpasswd

Setting VNC Server
vi /etc/sysconfig/vncservers

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x600"

Restart VNC
service vncserver restart

edit file start up
vncserver -kill :1
vi .vnc/xstartup

#twm &
exec gnome-session &

Restart VNC
service vncserver start
service vncserver restart

—END—


yum -y groupinstall Desktop
yum -y install tigervnc-server
yum -y install xorg-x11-fonts-Type1
chkconfig vncserver on
vncpasswd

Google Drive Linux Client using GDrive

Installing GDrive – Google Drive Linux Client

Simply download the latest version from their github page HERE

For my Centos 6 server I used this one : drive-linux-x64 v1.9.0

(right click and copy link url then paste into wget below)

wget -O /usr/local/bin/gdrive “paste url here”

I copied the file into /usr/local/bin so it is globally available to all users on my server, and I also renamed it to gdrive juat as I thought that would be easier to remember !! Dont forget to make the file executable (chmod +x /usr/local/bin/gdrive) and thats it !!!

When you first run any gdrive command it will prompt you to link it to your google drive account and give it permissions.
The program will then return with a url you need to link it to your account. Here is how I did it :
1) Open Chrome (or any browser) and log in to the Google account you want to link gdrive with
2) Make sure you can see in your apps Google Drive appearing (the menu in the top right is normally where it appears
3) Paste in the url from the output of the ‘gdrive list’ you did earlier, and accept the permissions prompt it needs to enable gdrive to upload and download files.

Uploading a file – Google Drive Linux Client
gdrive upload -r /var/www/html

Downloading a file from Google Drive Linux Client with GDrive
gdrive list
Id Title Size Created
0B0tRrdcY7CwJZHh5ZmVpZHRMYW8 drive-linux-amd64 10 MB 2014-09-25 17:47:08
0B0tRrdcY7CwJY2lNS2x3NC1lQUU drive-linux-386 8 MB 2014-09-25 17:47:01
0B0tRrdcY7CwJR3lmZnlRaFZwOHc drive-linux-arm 9 MB 2014-09-25 17:46:57
0B0tRrdcY7CwJQlRfQUVxY2hkWUE drive-linux-rpi 9 MB 2014-09-25 17:46:52

gdrive download -i 0B0tRrdcY7CwJZHh5ZmVpZHRMYW8