Hapi 1: Shkarkimi/instalimi i Apache 2.4
Hapi 2: Shkarkimi/instalimi i MySQL
Hapi 4: Fillimi/ndalimi i pirgut LAMP
konkluzioni
Përpilimi i pirgut tuaj LAMP ju lejon të përdorni versionet më të fundit të Apache, MySQL dhe PHP. Duke përdorur menaxherin e paketave CentOS 6, ju merrni Apache 2.2, MySQL 5.1 dhe PHP 5.3. Menaxheri i paketave instalon vetëm përditësime të sigurisë nga ekipi CentOS.
Si administrator i sistemit, ju e dini se mbajtja e softuerit të përditësuar është thelbësore. Dhe me serverin tuaj të internetit përballë internetit, duhet të siguroheni që softueri i serverit të uebit të përditësohet për të parandaluar dobësitë.
Ky artikull ju mëson se si të përpiloni grupin tuaj LAMP. Secila prej komandave do të shpjegohet duke përdorur formatin e mëposhtëm.
# Commands will be listed here
An explanation of the commands will be stated here.
Hapi 1: Shkarkimi/instalimi i Apache 2.4
Për këtë artikull, ne do të përdorim një pasqyrë të paracaktuar; por nëse dëshironi, mund të përdorni një pasqyrë tjetër nga faqja e pasqyrës Apache me një telefonatë nga VPS-ja juaj.
curl -q -s apache.org/dyn/closer.cgi > /tmp/closer
sed -e 151b -e '$!d' /tmp/closer
The curl command sends an HTTP request to the URL, and retrieves its contents. We redirect the output to /tmp/closer, and then the sed command cuts it down to something you can read.
Do të shihni një lidhje pasqyre që gjendet brenda seksionit. Thjesht zëvendësoni çdo lidhje të specifikuar në këtë artikull me atë pasqyrë.
Shkarkoni burimin në Apache 2.4.
cd /usr/src && wget http://apache.mirrors.ionfish.org/httpd/httpd-2.4.17.tar.gz && tar xvf httpd-2.4.17.tar.gz
The first part of this command will change our current directory to /usr/src, then the wget section will download the source. The last part of this command unzips the source.
Meqenëse Apache kërkon APR dhe APR-util, bëni sa më poshtë:
wget http://apache.mirrors.ionfish.org/apr/apr-1.5.2.tar.gz && tar xvf apr-1.5.2.tar.gz && mv apr-1.5.2 httpd-2.4.17/srclib/apr
wget http://apache.mirrors.ionfish.org/apr/apr-util-1.5.4.tar.gz && tar xvf apr-util-1.5.4.tar.gz && mv apr-util-1.5.4 httpd-2.4.17/srclib/apr-util
These commands will download the sources for APR and APR-util, and unzip them. Then, we move the source into Apache's build directory so that Apache will build properly.
Meqë na duhet një përpilues i duhur C, do të na duhet të instalojmë një duke përdorur menaxherin e paketave.
yum groupinstall 'Development Tools' -y
yum install gcc-c++ -y
yum install pcre-devel -y
yum install bison bison-devel -y
yum install ncurses-devel -y
yum install perl-devel -y
As I've mentioned above, we still need to obtain Apache's prerequisites, so we'll be installing them using the package manager.
Punë e mrekullueshme! Tani, është koha për të konfiguruar dhe ndërtuar Apache.
cd httpd-2.4.17 && ./configure
The cd httpd-2.4.17 part changes our current working directory to httpd-2.4.17/. When we run ./configure, we're configuring our system to build Apache.
Lejo që sistemi të konfigurojë burimin për instalim, nuk duhet të zgjasë shumë. Pasi të keni përfunduar, ekzekutoni:
make && make install
cp support/apachectl /usr/sbin
chmod 755 /usr/sbin/apachectl
The make section of these commands will build the software. When we run make install, we effectively install Apache onto our system. Now, we need to copy it to the secure bin directory (cp signifies copy). Finally, we'll give it permissions to execute with chmod 755.
Urime, ju keni instaluar me sukses Apache 2.4!
Hapi 2: Shkarkimi/instalimi i MySQL
Tani, le të instalojmë MySQL, një bazë të dhënash e përdorur nga shumë aplikacione ueb. Për shkak se MySQL tashmë ofron versionin më të fundit në formën e një RPM, është më e lehtë të përdoret skedari i tyre i instalimit të para-ndërtuar dhe më pas ta konfiguroni atë. Ne do të përdorim depon zyrtare të MySQL.
cd /usr/src && wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm && rpm -i mysql57-community-release-el6-7.noarch.rpm
yum install mysql-community-server -y
The first command is where we download the RPM file to enable the MySQL repository on our system. Then, rpm -i installs the RPM file. Finally, we'll install MySQL from the official MySQL repository.
Hapi 3: Shkarkimi/instalimi i PHP
PHP ka disa varësi që ne duhet t'i instalojmë, kështu që le të shkojmë tek ajo së pari.
yum install -y libxml2-devel libcurl-devel libmcrypt libmcrypt-devel
We're using the package manager once more - but this time, we're installing some components to allow PHP applications to run properly.
Shkarkoni burimin për PHP, i cili bëhet duke ekzekutuar komandat e mëposhtme:
wget http://docs.php.net/distributions/php-5.6.15.tar.gz && tar xvf php-5.6.15.tar.gz
cd php-5.6.15
./configure --with-pear=/usr/lib/pear --enable-libxml --with-pdo-mysql --with-mysqli --with-mysql --enable-mbstring --with-mcrypt --with-apxs2=/usr/local/apache2/bin/apxs --enable-maintainer-zts --with-curl=/lib
make && make install
The first part, wget, is where we download the source to PHP 5.6.15. Then, we change our working directory to php-5.6.15. Finally, we configure PHP with the features required to run various web applications, such as e-commerce websites.
Kini parasysh, nëse merrni një mesazh që përmban "/path/to/perl", do t'ju duhet të redaktoni skedarin /usr/local/apache2/bin/apxs.
nano /usr/local/apache2/bin/apxs
Ndrysho rreshtin e parë në:
#!/usr/bin/perl -w
Hapi 4: Fillimi/ndalimi i pirgut LAMP
Meqenëse ne kemi ndërtuar Apache nga e para, ai nuk përfshin një shërbim të para-ndërtuar. Ne do të duhet të konfigurojmë vetë skriptin init.
cd /usr/src && wget https://gist.githubusercontent.com/anonymous/62b0b788f86e7773e901/raw/6bcc88f9354f7139916272ac7a4eb998b1f26fdd/httpd-init
mv httpd-init /etc/init.d/httpd
chmod 755 /etc/init.d/httpd
The first part, where we cd, changes our working directory to the directory where we build/compile software. Then, with &&, we execute anything after it as well, which in this case, downloads the service file for Apache. Finally, we give permission for it to be executed with the chmod command.
U bë dhe u bë!
Tani, le të fillojmë Apache + MySQL + PHP:
service httpd start
service mysqld start
With the service commands, we can manage the status of services. In this case, we've started the services httpd and mysqld.
PHP fillon me Apache, nuk fillon përmes një shërbimi.
konkluzioni
Në këtë artikull, ne trajtuam se si të konfiguroni një pirg LAMP nga e para duke përdorur versionet e përditësuara të Apache/PHP/MySQL. Megjithëse kërkon më shumë administrim për t'u menaxhuar, kjo teknikë është e dobishme kur duam një stack më të ri se sa ofron shitësi i sistemit operativ.