LAMP je akronim za skupinu softvera otvorenog koda gde je Linux, Apache, MySQL i PHP. Ovaj paket je postao veoma popularan zbog svoje cene, lakoće prilagođavanja. Na Archu se LAMP ne dobija već prepodešena, pa je potrebno izvršiti podešavanja.
Arch Linux je 25 marta 2013 godine zvanično izbacio MySQL kao glavnu implementaciju baza podataka. Nova implementacija je sada MariaDB koji je 99% kompatibilan sa MySQL. Kako se meni čini MariaDB i MySQL je nov LibreOffice OpenOffice slučaj.
Instaliranje potrebnih komponenti
Instaliranje potrebnih komponenti
[root@mojracunar-pc ~]# pacman -S apache php php-apache mariadb php-gd php-mcrypt phpmyadmin
Omogućiti da se httpd startuje prilikom podizanja sistema
[root@mojracunar-pc ~]# systemctl enable httpd.service
Proverite vašu hosts datoteku
[root@mojracunar-pc ~]# nano /etc/hosts
Da li je ispravna, u suprotnom httpd server se neće startovati, na kraju adrese za localhost mora se naći i ime računara
: : 1 localhost.localdomain localhost myhostname
Ukoliko želite da na serveru držite samo jednu prezentaciju, ova podešavanja su sasvim dovoljna. No ukoliko želite da imate više prezentacije potrebno je izvršiti sledeća podešavanja.
[root@mojracunar-pc ~]# nano /etc/httpd/conf/httpd.conf
I na samom kraju datoteke dodati sledeće
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
A u samoj datoteci može dodati na primer
NameVirtualHost *:80
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/
#ServerName
#ServerAlias paaad.org.rs
ServerAdmin root@localhost.com
# Logging
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
<Directory /var/www/html/>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/sajt1
ServerName www.testiranje.org.rs
ServerAlias testiranje.org.rs
ServerAdmin email@mail.com
# Logging
ErrorLog logs/testiranje.org.rs-error_log
CustomLog logs/testiranje.org.rs-access_log common
<Directory /var/www/html/sajt1>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/sajt2
ServerName www.forum.com
ServerAlias forum.com
ServerAdmin email@mail.com
# Logging
ErrorLog logs/forum.com-error_log
CustomLog logs/forum.com-access_log common
<Directory /var/www/html/sajt2>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/sajt3
ServerName www.onlineshop.com
ServerAlias onlineshop.com
ServerAdmin email@mail.com
# Logging
ErrorLog logs/onlineshop.com-error_log
CustomLog logs/onlineshop.com-access_log common
<Directory /var/www/html/sajt3>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
________________________________________________________________
Gde je prvi sajt defaultna root prezentacija i do nje se dolazi kucanjem ip adrese servera u adres baru, ili localhost ako se server nalazi na istom računaru, dok se do ostalih prezentacija dolazi kucanjem navedene adrese.
Pokrenite httpd server
[root@mojracunar-pc ~]# systemctl start httpd
Da bi httpd čitao php strane potrebno je uraditi par podešavanja. U datoteku
I na samom kraju datoteke dodati sledeće
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
A u samoj datoteci može dodati na primer
________________________________________________________________
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/
#ServerName
#ServerAlias paaad.org.rs
ServerAdmin root@localhost.com
# Logging
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
<Directory /var/www/html/>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/sajt1
ServerName www.testiranje.org.rs
ServerAlias testiranje.org.rs
ServerAdmin email@mail.com
# Logging
ErrorLog logs/testiranje.org.rs-error_log
CustomLog logs/testiranje.org.rs-access_log common
<Directory /var/www/html/sajt1>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/sajt2
ServerName www.forum.com
ServerAlias forum.com
ServerAdmin email@mail.com
# Logging
ErrorLog logs/forum.com-error_log
CustomLog logs/forum.com-access_log common
<Directory /var/www/html/sajt2>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# $domain HTTP Virtual Host
<VirtualHost *:80>
# General
DocumentRoot /var/www/html/sajt3
ServerName www.onlineshop.com
ServerAlias onlineshop.com
ServerAdmin email@mail.com
# Logging
ErrorLog logs/onlineshop.com-error_log
CustomLog logs/onlineshop.com-access_log common
<Directory /var/www/html/sajt3>
DirectoryIndex index.htm index.html index.php
AddHandler cgi-script .cgi .pl
Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
________________________________________________________________
Gde je prvi sajt defaultna root prezentacija i do nje se dolazi kucanjem ip adrese servera u adres baru, ili localhost ako se server nalazi na istom računaru, dok se do ostalih prezentacija dolazi kucanjem navedene adrese.
Pokrenite httpd server
[root@mojracunar-pc ~]# systemctl start httpd
Da bi httpd čitao php strane potrebno je uraditi par podešavanja. U datoteku
[root@mojracunar-pc ~]# nano /etc/httpd/conf/httpd.conf
Na kraju LoadModule liste dodati LoadModule php5_module modules/libphp5.so
A na kraju Include liste dodajte Include conf/extra/php5_module.conf
Otkomentaršite liniju MIMEMagicFile conf/magic
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Dodajte u datoteku
Na kraju LoadModule liste dodati LoadModule php5_module modules/libphp5.so
A na kraju Include liste dodajte Include conf/extra/php5_module.conf
Otkomentaršite liniju MIMEMagicFile conf/magic
U dir_module dodajte
DirectoryIndex index.html index.php
</IfModule>
[root@mojracunar-pc ~]# nano /etc/httpd/conf/mime.types
application/x-httpd-php5 php php5
U datoteku
[root@mojracunar-pc ~]# nano /etc/httpd/conf/extra/php5_module.conf
dodajte u niz DirectoryIndex index.php index.phtml index.html
application/x-httpd-php5 php php5
U datoteku
[root@mojracunar-pc ~]# nano /etc/httpd/conf/extra/php5_module.conf
dodajte u niz DirectoryIndex index.php index.phtml index.html
U datoteci php.ini otkomentarišite sledeće ekstenzije
[root@mojracunar-pc ~]# nano /etc/php/php.ini
extension=gd.so
extension=mcrypt.so
extension=pdo_mysql.so
extension=mysqli.so
extension=mysql.so
Iskomentarišite u datoteci
[root@mojracunar-pc ~]# /etc/mysql/my.cnf
#skip-networking
Pokrenite MariDB Server
Pokretanje MariaDB prilikom startovanja računara
[root@mojracunar-pc ~]# systemctl enable mysqld.service
extension=pdo_mysql.so
extension=mysqli.so
extension=mysql.so
Iskomentarišite u datoteci
[root@mojracunar-pc ~]# /etc/mysql/my.cnf
#skip-networking
Pokrenite MariDB Server
[root@mojracunar-pc ~]# systemctl start mysql
[root@mojracunar-pc ~]# systemctl enable mysqld.service
[root@mojracunar-pc ~]# mysql_secure_installation
Da bi phpMyAdmin radio prvo morate da iskopirate
[root@mojracunar-pc ~]# cp /etc/webapps/phpmyadmin/apache.example.conf /etc/httpd/conf/extra/httpd-phpmyadmin.conf
U httpd.conf dodajte
[root@mojracunar-pc ~]# nano /etc/httpd/conf/httpd.conf# phpMyAdmin configuration
Include conf/extra/httpd-phpmyadmin.conf
Dozvolite pristup phpMyAdminu tako što ćete iskomentarisati
[root@mojracunar-pc ~]# nano /etc/webapps/phpmyadmin/.htaccess
#deny from all
A možete po vašim potrebama i dozvoliti pristup samo iz određenih opsega IP adresa, npr.
deny from all
allow from localhost
allow from 192.168.1.0/24
Dodajte blowfish "frazu"
[root@mojracunar-pc ~]# nano /etc/webapps/phpmyadmin/config.inc.php
blowfish se može generisati na ovoj strani
$cfg['blowfish_secret'] = 'qtdRoGmbc9{8IZr323xYcSN]0s)r$9b_JUnb{~Xz'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Da bi ste izvukli maksimum iz phpMyAdmina potrebno je uraditi još par podešavanja. U datoteci config.inc.php otkomentarisati sledeće linije
___________________________________________________
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';
___________________________________________________
Otvoriti phpmyadmin i importovati tabelu usr/share/webapps/phpMyAdmin/examples/create_tables.sqlIzvršite sledeći sql kod:
___________________________________________________
GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
GRANT SELECT (
Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
Execute_priv, Repl_slave_priv, Repl_client_priv
) ON mysql.user TO 'pma'@'localhost';
GRANT SELECT ON mysql.db TO 'pma'@'localhost';
GRANT SELECT ON mysql.host TO 'pma'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
ON mysql.tables_priv TO 'pma'@'localhost';
GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost';
___________________________________________________
Restartujte MariaDB i httpd
[root@mojracunar-pc ~]# systemctl restart httpd
[root@mojracunar-pc ~]# systemctl restart mysqld
Нема коментара:
Постави коментар