0% found this document useful (0 votes)
70 views

Install Apache PHP5 MySQL5.6 Debian 9.6

This document provides instructions for configuring SSH root login, installing Apache2 and enabling mod_rewrite, installing PHP 5.6 and associated modules, installing and configuring MySQL 5.6, installing PhpMyAdmin and changing its port, and creating a virtual host. Key steps include editing SSH configuration files to enable root login, installing and enabling Apache modules, adding PHP and MySQL repositories and installing their packages, configuring MySQL, creating MySQL users, installing PhpMyAdmin and configuring it under a non-standard port, and setting up a virtual host configuration file.

Uploaded by

Muh. Hatta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Install Apache PHP5 MySQL5.6 Debian 9.6

This document provides instructions for configuring SSH root login, installing Apache2 and enabling mod_rewrite, installing PHP 5.6 and associated modules, installing and configuring MySQL 5.6, installing PhpMyAdmin and changing its port, and creating a virtual host. Key steps include editing SSH configuration files to enable root login, installing and enabling Apache modules, adding PHP and MySQL repositories and installing their packages, configuring MySQL, creating MySQL users, installing PhpMyAdmin and configuring it under a non-standard port, and setting up a virtual host configuration file.

Uploaded by

Muh. Hatta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Enable SSH Root Login

- Edit file /etc/ssh/sshd_config

edit line "PermitRootLogin without-password" to "PermitRootLogin yes"

===================================================================================
==========

#apt-get update

Install Apache2
#apt-get install apache2

Enable mod_rewrite
#a2enmod rewrite

Edit 000-default.conf
#service apache2 stop
#pico /etc/apache2/sites-available/000-default.conf

delete all line and add above

==================================================================================
<VirtualHost *:80>
# 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 />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
allow from 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:warn

ErrorLog ${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>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

===================================================================================
=============

#service apache2 start

Add Repository PHP5.6


#apt-get install apt-transport-https lsb-release ca-certificates
#wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
#echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" >
/etc/apt/sources.list.d/php.list
#apt-get update

Install PHP5.6
#apt-get install php5.6 libapache2-mod-php5.6

Show PHP5.6 Module


#apt-cache search php5.6

Install PHP5.6 Module


#apt-get install php5.6-bz2 php5.6-curl php5.6-gd php5.6-json php5.6-mbstring
php5.6-mcrypt php5.6-mysql php5.6-sqlite3 php5.6-xml php5.6-xmlrpc php5.6-xsl
php5.6-zip

Install Extra Module


#apt-get install php-gettext php-tcpdf php-pear

Install MySQL 5.6


#wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
#dpkg -i mysql-apt-config_0.8.10-1_all.deb
#apt-get update
#apt-get install mysql-community-server

============== Configure MySQL ==================


- Edit /etc/mysql/my.cnf
#pico /etc/mysql/my.cnf
- Add above line

[mysqld]
event-scheduler = On
pid-file = /var/run/mysqld/mysqld.pid

socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
explicit_defaults_for_timestamp

# Recommended in standard MySQL setup


sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

# Disabling symbolic-links is recommended to prevent assorted security risks


symbolic-links=0

- then save
=======================================================

Restart MySQL Service


#service mysql restart

=============== Sample Create USER MySQL


===================================================
#mysql -u root -p
mysql>CREATE USER 'webmaster'@'localhost' IDENTIFIED BY 'your_password';
mysql>GRANT ALL PRIVILEGES ON * .* TO 'webmaster'@'localhost' WITH GRANT OPTION;
mysql>FLUSH PRIVILEGES;

mysql>CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'pma';


mysql>GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'phpmyadmin'@'localhost' WITH GRANT
OPTION;
mysql>FLUSH PRIVILEGES;

===================================================================================
=========
Install PhpMyAdmin
#apt-get install phpmyadmin

============================= Change PhpMyAdmin Port


========================================
- Remove old configuration

#service apache2 stop


#a2disconf phpmyadmin

#rm /etc/apache2/conf-enabled/phpmyadmin.conf
#rm /etc/apache2/conf-available/phpmyadmin.conf

- Edit /etc/apache2/ports.conf
#pico /etc/apache2/ports.conf
Add above line

Listen 2082

- Create directory port-2082 in /var/www


#mkdir /var/www/port-2082

- Create file port-2082.conf in /etc/apache2/sites-available


#pico /etc/apache2/sites-available/port-2082.conf

add above line to file

<VirtualHost *:2082>
# 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/port-2082

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/port-2082>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
allow from 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:warn

ErrorLog ${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

Alias /phpmyadmin /usr/share/phpmyadmin

Include /etc/phpmyadmin/apache.conf

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

===========================================================================

- activate port-2082.conf
#a2ensite port-2082
#cd /var/www/port-2082/
#ln -s /usr/share/phpmyadmin/
#service apache2 start

====================================== create virtual host


========================================
#service apache2 stop

Create directory for virtual host example "apps"


#mkdir /var/www/apps

Create file configuration vhost-apps.conf in /etc/apache2/sites-available


#pico /etc/apache2/sites-available/vhost-apps.conf

add above line to file

<VirtualHost *:80>
# 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
ServerName apps.sindomakassar.com
DocumentRoot /var/www/apps

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/apps>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
allow from 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:warn

ErrorLog ${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>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

===================================================================================
=================

- activate vhost-apps.conf
#a2ensite vhost-apps
#service apache2 start

You might also like