Heim > Backend-Entwicklung > PHP-Tutorial > LAMP-Installationsanleitung

LAMP-Installationsanleitung

不言
Freigeben: 2023-03-29 18:28:01
Original
5110 Leute haben es durchsucht


Dieser Artikel stellt hauptsächlich das LAMP-Installations-Tutorial vor, das einen gewissen Referenzwert hat. Jetzt kann ich es mit Ihnen teilen

Linux-Konfiguration

wget installieren

1

sudo yum install wget

Nach dem Login kopieren

Linux-Bibliothek aktualisieren

1

sudo yum -y update

Nach dem Login kopieren

vim installieren

1

sudo yum install vim

Nach dem Login kopieren

zip installieren und entpacken

1

sudo yum install zip unzip;

Nach dem Login kopieren

Die Konfiguration zeigt

1

vi ~/.vimrc输入:set nu 后退出保存

Nach dem Login kopieren

Apache installieren

Abhängigkeitspakete installieren

1

sudo yum install gcc gcc-c++ perl perl-devel expat expat-devel autoconf libtool openssl openssl-devel

Nach dem Login kopieren

Apr installieren

1

2

下载地址:https://apr.apache.orgtar -zxvf apr-1.6.3.tar.gzcd apr-1.6.3./configure --prefix=/usr/local/apr

make && make install

Nach dem Login kopieren

Apr-util installieren

1

2

3

下载地址:https://apr.apache.org/tar -zxvf apr-util-1.6.1.tar.gz

cd apr-util-1.6.1./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

make && make install

Nach dem Login kopieren

pcre installieren

1

2

3

下载地址:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

tar zxvf pcre-8.42.tar.gzcd pcre-8.42./configure --prefix=/usr/local/pcre

make && make install

Nach dem Login kopieren

Apache installieren

1

2

3

4

tar zxvf httpd-2.4.33.tar.gz

cd httpd-2.4.33

./configure \

--prefix=/usr/local/apache \--enable-ssl \--enable-so \--with-apr=/usr/local/apr \--with-apr-util=/usr/local/apr-util \--with-pcre=/usr/local/pcremake && make install

Nach dem Login kopieren

Umgebungsvariablen konfigurieren

1

vi /etc/profileexport PATH="$PATH:/usr/local/apache/bin"source /etc/profile

Nach dem Login kopieren

Autostart beim Booten festlegen

1

vim /etc/rc.d/rc.local/usr/local/apache/bin/apachectl start

Nach dem Login kopieren

Andere Konfigurationen

1

2

3

4

cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bakcp /usr/local/apache/conf/extra/httpd-vhosts.conf /usr/local/apache/conf/extra/httpd-vhosts.conf.bakvi  /usr/local/apache/conf/httpd.conf去掉152行前面的#号,开启重写模块去掉194行前面的#号,去除错误信息239行允许重写 AllowOverride All

 

开启Apache:

apachectl -k start

Nach dem Login kopieren

Ausschalten die Firewall:

1

2

CentOS6:service iptables stop   临时关闭

chkconfig --level 2345 iptables off 永久关闭CentOS7:systemctl stop firewalld.service  #令关闭防火墙systemctl disable firewalld.service  #关闭防火墙开机自启动通过浏览器输入IP测试成功

Nach dem Login kopieren

MySQL installieren

MySQL-Kompilierungs- und Installations-Tutorial-Artikel

1

http://www.runoob.com/linux/mysql-install-setup.html

Nach dem Login kopieren

Abhängigkeiten installieren


(1 )cmake ist eine neue Version des MySQL-Kompilierungstools

1

sudo yum install gcc gcc-c++ cmake ncurses-devel

Nach dem Login kopieren

MySQL-Benutzer hinzufügen

1

useradd -s /sbin/nologin -M mysql

Nach dem Login kopieren

MySQL installieren

1

2

3

4

5

6

7

tar zxvf mysql-5.6.40.tar.gz

cd mysql-5.6.40

 

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \-DMYSQL_DATADIR=/usr/local/mysql/data \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS=all \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DWITH_INNODB_MEMCACHED=1 \-DWITH_DEBUG=OFF \-DWITH_ZLIB=bundled \-DENABLED_LOCAL_INFILE=1 \-DENABLED_PROFILING=ON \-DMYSQL_MAINTAINER_MODE=OFF \-DMYSQL_TCP_PORT=3306make

 

make install

Nach dem Login kopieren

Berechtigungen ändern

1

2

3

4

cd /usr/local/mysqlchown mysql.mysql /usr/local/mysql/datamkdir tmpchown mysql.mysql /usr/local/mysql/tmp

rm -f /etc/my.cnf

cp support-files/my-default.cnf /etc/my.cnf

scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql

Nach dem Login kopieren

Daemon beitreten Prozess

1

2

cd /usr/local/mysqlcp support-files/mysql.server /etc/init.d/mysqld

chkconfig --add mysqld

Nach dem Login kopieren

Umgebungsvariablen konfigurieren

1

vi /etc/profileexport PATH="/usr/local/mysql/bin"source /etc/profile

Nach dem Login kopieren

MySQL starten

1

2

service mysqld start

mysql -u root -p #第一次登陆不需要密码,回车即可set password for root@localhost = password('root');  #修改密码

Nach dem Login kopieren

PHP installieren

Abhängigkeitspakete installieren

1

sudo yum install gcc gcc-c++ libxml2 libxml2-devel curl-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel  zlib zlib-devel glibc glibc-devel glib2 glib2-devel

Nach dem Login kopieren

PHP installieren

1

2

3

4

5

tar zxvf php-7.2.3.tar.gz

cd  php-7.2.3

 

./configure \

--prefix=/usr/local/php \--enable-mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-mysql-sock=/usr/local/mysql/tmp/mysql.sock \--with-apxs2=/usr/local/apache/bin/apxs \--with-zlib \--with-gd \--with-png-dir \--with-jpeg-dir \--with-freetype-dir \--with-openssl \--enable-mbstring \--enable-xml \--enable-zip \--enable-sockets \--with-curlmake && make install

Nach dem Login kopieren

Konfigurieren Sie die Apache- und PHP-Assoziation (ca. 154 Zeilen)

1

2

3

vi /usr/local/apache/conf/httpd.conf# 加入 在 加载了PHP模块之后<FilesMatch "\.php$">

    SetHandler application/x-httpd-php

</FilesMatch># 保存,退出,重启

Nach dem Login kopieren

Konfigurieren Sie Umgebungsvariablen

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

vi /etc/profile

 

export PATH="$PATH:/usr/local/php/bin"source /etc/profile

 

cp /root/package/php-7.2.3/php.ini-development /usr/local/php/lib/php.ini

vi /usr/local/php/lib/php.inidate.timezone = PRC  (大约在932行)

 

 

vi /usr/local/apache/conf/httpd.conf258行,默认首页加入index.php483行,开启虚拟主机支持

vi /usr/local/apache/conf/extra/httpd-vhosts.conf

 

vi /usr/local/apache/conf/extra/httpd-vhosts.conf<VirtualHost *:80>

    ServerAdmin www.huiwan.com

    DocumentRoot "/mnt/hgfs/web/huiwan"

    ServerName www.huiwan.com    #ErrorLog "logs/dummy-host2.example.com-error_log"

    #CustomLog "logs/dummy-host2.example.com-access_log" common    <Directory "/mnt/hgfs/web/huiwan">

        Options indexes Multiviews

        AllowOverride All

        Require all granted    </Directory></VirtualHost>

Nach dem Login kopieren

Verwandte Empfehlungen:

LAMP Detaillierte Grafik- und Texterklärung von Erstellen eines persönlichen Blogs basierend auf dem PHP-Modul

Linux CentOS5 erstellt eine Lampenumgebung

Das obige ist der detaillierte Inhalt vonLAMP-Installationsanleitung. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage