How to Install Apache 2.4, MySQL/MariaDB, and PHP 7 (LAMP) on VPS Os Debian 9 Stretch 32/64. How to install a LAMP server on the VPS corresponding especially in the title above. What is it the LAMP? LAMP is a group of software that is open source consists of Linux, Apache, MySQL, and PHP to build and run a web server. Just let us start our first install apache in advance which functions as a web server. The trick is to type the following command in the terminal with putty or the like:
Linux operating system, Apache 2.4 web server, MySQL/MariaDB relational database management system (RDBMS) and PHP 7 server-side programming language.
The trick is to type the following command in the terminal with putty or the like:
# sudo apt update
Output like this:
http://security.debian.org stretch/updates InRelease
Hit:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
38 packages can be upgraded. Run 'apt list --upgradable' to see them
Next Install latest udpdate, copy and run command below:
# sudo apt-get upgrade
Output like this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
apt bash debconf debian-archive-keyring debianutils dpkg file gcc-6-base init init-system-helpers libapt-pkg5.0 libc-bin libc-l10n libc6 libcryptsetup4 libdns-export162
libelf1 libgcc1 libgcrypt20 libisc-export160 libmagic-mgc libmagic1 libpam-modules libpam-modules-bin libpam-runtime libpam0g libssl1.0.2 libssl1.1 libstdc++6
libsystemd0 libudev1 locales login multiarch-support passwd perl-base systemd systemd-sysv
38 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 26.3 MB of archives.
After this operation, 82.9 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 debianutils amd64 4.8.1.1 [100 kB]
Get:2 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 bash amd64 4.4-5 [1427 kB]
....
..
...
Setting up libmagic1:amd64 (1:5.30-1) ...
Setting up libssl1.0.2:amd64 (1.0.2l-2) ...
Processing triggers for libc-bin (2.24-11) ...
Setting up libssl1.1:amd64 (1.1.0f-3) ...
Setting up libc-l10n (2.24-11) ...
Setting up locales (2.24-11) ...
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
Setting up init (1.48) ...
Setting up libdns-export162 (1:9.10.3.dfsg.P4-12.3) ...
Setting up file (1:5.30-1) ...
Processing triggers for libc-bin (2.24-11) ..
Next install latest Apache version 2.4:
# sudo apt install apache2
Outputs like this:
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 ssl-cert Suggested packages: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 ssl-cert 0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/2143 kB of archives. After this operation, 7137 kB of additional disk space will be used. Do you want to continue? [Y/n] y ebconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package mime-support. (Reading database ... 13992 files and directories currently installed.) Preparing to unpack .../00-mime-support_3.60_all.deb ... Unpacking mime-support (3.60) ... Selecting previously unselected package libapr1:amd64. .... .. ... Enabling module filter. Enabling module deflate. Enabling module status. Enabling module reqtimeout. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service ? /lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service ? /lib/systemd/system/apache-htcacheclean.service. Processing triggers for libc-bin (2.24-11) ... Processing triggers for systemd (232-25) ...
Please ceck IP Or your VPS http://IP-VPS
Outputs like this:

The Apache HTTP server is successfully installed on your server. You can change the default page by editing the index.html file located in/var/www/html:
start, stop and restart Apache server with command:
# sudo systemctl stop apache2
# sudo systemctl stop apache2
# sudo systemctl restart apache2
# sudo systemctl reload apache2
# sudo systemctl status apache2
You need to edit or replace with new config file in /etc/apache2/conf-available/ directory. Replace all with below script config:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Next Install MariaDB or MYSQL:
# sudo apt install default-mysql-server
or
# sudo apt install mariadb-server
Outputs like this:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
galera-3 gawk libaio1 libarchive13 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libjemalloc1 liblwp-mediatypes-perl liblzo2-2 libmariadbclient18
libmpfr4 libreadline5 libreadline7 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common
mariadb-server-10.1 mariadb-server-core-10.1 mysql-common psmisc readline-common socat
Suggested packages:
gawk-doc lrzip libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test
netcat-openbsd tinyca readline-doc
The following NEW packages will be installed:
default-mysql-server galera-3 gawk libaio1 libarchive13 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libjemalloc1 liblwp-mediatypes-perl liblzo2-2
libmariadbclient18 libmpfr4 libreadline5 libreadline7 libsigsegv2 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1 mariadb-client-core-10.1
mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 mysql-common psmisc readline-common socat
0 upgraded, 37 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/27.1 MB of archives.
After this operation, 195 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libmpfr4:amd64.
(Reading database … 14762 files and directories currently installed.)
Preparing to unpack …/libmpfr4_3.1.5-1_amd64.deb …
….
..
…
Setting up libdbd-mysql-perl (4.041-2) …
Setting up mariadb-client-10.1 (10.1.23-9+deb9u1) …
Setting up mariadb-server-10.1 (10.1.23-9+deb9u1) …
Created symlink /etc/systemd/system/mysql.service ? /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service ? /lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service ? /lib/systemd/system/mariadb.service.
Setting up default-mysql-server (1.0.2) …
Processing triggers for libc-bin (2.24-11) …
Processing triggers for systemd (232-25) …
Setting and COnfiguration username and Password MaridDB:
# sudo mysql_secure_installation
Next Install PHP Version 7:
# sudo apt install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-gd php7.0-opcache
and then restart apache:
# sudo systemctl restart apache2
Next Install PHPmyAdmin:
# apt-get -y install phpmyadmin
Finish….
If PHPmyAdmin can’t login, Solved: Error 1698 (28000) in MySQL/MariaDB
A few days ago, I got on a Debian Server 9 the database server installed MariaDB. The installation went through. Will anyway for E.g. phpMyAdmin the root access via a password required, can be deactivated as follows it: login via sudo mysql –u root –p MySQL/MariaDB. using use mysql; switch in the system database. the plugin via SQL command UPDATE user SET plugin=” WHERE user=‘root’; Disable. the SQL command UPDATE user SET .password=password(‘passwort-here’) WHERE user = ‘root’; put a password on flush privileges; clear the cache.