Script for å installere og sikre Apache2 PHP5 MySQL5 i Ubuntu /Debian

I denne raske artikkelen vil vise deg hvordan du installerer raskt en sikker lampe i Ubuntu og Debian via denne lille skriptet.


...




1- Lag fil Installlamp.sh.; og legge til følgende kode

 MYSQL_PASS = "YOUR_PASSWORD_HERE"; echo "+ Oppdatere apt-get ..." apt-get updateecho "+ Installere SSH ..." apt-get install -q -y sshecho " + Endre standard SSH port ... "sed -i 's /Port 22 /Port 28 /' /etc/ssh/sshd_config/etc/init.d/ssh restartecho" + Installere Apache2 ... "apt-get install - q -y apache2sed -i 's /ServerTokens Full /ServerTokens Prod /' /etc/apache2/conf.d/securitysed -i 's /ServerSignature On /ServerSignature Av /' /etc/apache2/conf.d/securitysed -i 's /TraceEnable On /TraceEnable Av /' /etc/apache2/conf.d/security/etc/init.d/apache2 reloada2enmod omskrive /etc /init.d /apache2 restartecho "+ Installere PHP5 ..." apt-get installere -q -y php5echo "+ Sikring php.ini fil ..." sed -i 's /disable_functions = /disable_functions = show_source, system, exec /' /etc/php5/apache2/php.inised -i 's /expose_php = On /expose_php = Av /'/etc/php5/apache2/php.inised -i' s /display_errors = On /display_errors = Av /'/etc/php5/apache2/php.inised -i' s /log_errors = Av /log_errors = On /'/etc/php5/apache2/php.inised -i' s /allow_url_fopen = On /allow_url_fopen = Av /'/etc/php5/apache2/php.iniecho "+ Installere MySQL Server ..." DEBIAN_FRONTEND = 'interaktiv' apt-get install -q -y mysql-servermysqladmin -u root-passordet $ MYSQL_PASSapt-get install -q -y php5-mysqlmysql_secure_installationhistory -cecho "+ Installasjon fullført!" 

2- Gjør skriptet kjørbar

 Chmod + x installlamp.sh 

3- Run thescript

 sudo ./installlamp.sh

Enjoy.For spørsmål, kan du legge ut på spør unixmen. Takket