Full installation of Linux LAMP server, Apache, MySql, PHP Debian 8
This tutorial describes how to comprehensively install a LAMP server or Apache basic services, MySql, Php and phpmyadmin.
Prok-by-step we will install all the packages.
We begin by setting the correct server hostname:
1 | nano /etc/hosts |
And edit
1 2 3 4 5 6 7 | 127.0.0.1 localhost.localdomain localhost 94.130.246.172 node.serwerweb.pl node # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters |
We are interested in the bold line.
IP address does not move we make only changes the hostname which will see our server.
We edit the file:
1 | nano /etc/hostname |
I change the
1 | node.serwerweb.pl |
In order to change the whole system restart server command:
1 2 | reboot |
validate the set hostname:
1 2 | hostname hostname -f |
Both commands should return us to the same value:
node.serwerweb.pl
1 2 3 4 | root@node:/tmp# hostname node.serwerweb.pl root@node:/tmp# hostname -f node.serwerweb.pl |
Next, we perform the system update:
1 2 | apt-get update apt-get upgrade |
Install the database engine MySQL or MariaDB
MariaDB:
1 | apt-get -y install mariadb-server mariadb-client |
Mysql:
1 | apt-get install mysql-server mysql-client |
The installer will ask you to set a password to the database.
We serve it twice.
Install web server in this case Apache
1 | apt-get -y install apache2 |
PHP Installation:
1 | apt-get -y install php5 libapache2-mod-php5 |
Then we restart apache php modules began to be seen.
1 | service apache2 restart |
To validate the work we create a php file phpinfo
1 | nano /var/www/html/info.php |
content:
1 | <!--?php phpinfo(); ?--> |
After passing page
1 | http://ADRESIP/info.php |
We should see a page with information about PHP:
The next step is ET modules php mysql and MariaDB, We search the repository:
1 | apt-cache search php5 |
1 | apt-get -y install php5-mysqlnd php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl |
I restart apache:
1 | service apache2 restart |
Installing APC Cache:
1 | apt-get install php5-apcu |
I restart apache:
1 | service apache2 restart |
As you can see in the picture below modules have been successfully installed you will see them in the phpinfo
The last step is to install fraficzny phpMyAdmin database management interface written in php.
1 | apt-get -y install phpmyadmin |
And we respond to the questions in the installer:
1 2 3 4 | Web server to reconfigure automatically: <-- apache2 Configure database for phpmyadmin with dbconfig-common?<-- Yes Password of the database's administrative user: <-- Podajemy wcześciej ustalone hasło przy instalacji mysql/mariadb MySQL application password for phpmyadmin: <-- Ponownie podajemy hasło ustalone wcześniej |
PhpMyAdmin is available at:
1 | http://ADRESIPSERWERA/phpmyadmin |
That's all we have a fully functional mysql web server
I can not zaisntalować mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket
│ ‘/var/run/mysqld/mysqld.sock’ (111)
two days googling the problem and nothing.
It looks like you lost mysql password
Try to make reinstallation:
yum remove mysql
yum -y install mariadb-server mariadb
service mariadb start
Then you log on to the server mysql command:
mysql -u root -p
Which of these two lines is upset because for me that none of them
127.0.0.1 localhost.localdomain localhost
94.130.246.172 node.serwerweb.pl node
otherwise. Whether “localhost.localdomain localhost” I turn on kompa own name, for example.: “Romain mojkomp.localdo mojkomp” or leave it intact? A line below have exactly the type the IP address that was specified in Whose example 94.130.246.172 or maybe my external IP address ? Then I enter the server address node.serwerweb.pl no change or should change your domain mojadomena.pl? As for me, too much confusion in this manual, and this can only understand one, to whom this statement in principle, there is no need or, someone, who does not think and rewrites everything indiscriminately and then wonders why not work. Sorry if my doubts amuse or annoy someone but I would understand this and do it properly.