LAMP快速安裝

2021-07-29 19:22:47 字數 4082 閱讀 6824

1. 版本介紹

apache安裝

安裝mysql-5.5.48

​安裝依賴

yum install ncurses-devel libaio-devel -y

​cd /server/tools/

​wget

​tar zxf cmake-2.8.8.tar.gz

cd cmake-2.8.8

./configure

gmake

gmake install​​

安裝mysql

useradd mysql -s /sbin/nologin -m

cd /server/tools/

wget

​tar zxvf mysql-5.5.48.tar.gz

​cd mysql-5.5.48

​cmake .

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci \

-dextra_charsets=gbk,gb2312,utf8,ascii \

-denabled_local_infile=on \

-dwith_innobase_storage_engine=1 \

-dwith_federated_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwithout_example_storage_engine=1 \

-dwithout_partition_storage_engine=1 \

-dwith_fast_mutexes=1 \

-dwith_zlib=bundled \

-denabled_local_infile=1 \

-dwith_readline=1 \

-dwith_embedded_server=1 \

-dwith_debug=0

​make && make install​​

​初始化資料庫​​

cd /server/tools/mysql-5.5.48/support-files/

​/bin/cp my-small.cnf /etc/my.cnf

​cd /server/tools/mysql-5.5.48/support-files/

cp mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig mysqld on

sleep 1

​echo 'export 

​source /etc/profile

​mysqladmin -u root password '123456'​4.

安裝php php-5.3.27

​安裝依賴

yum install zlib-devel libxml2-devel 

libjpeg-turbo-devel libiconv-devel -y

​yum install freetype-devel libpng-devel gd-devel 

libcurl-devel libxslt-devel libtool-ltdl-devel openssl-devel -y

​cd /server/tools/

wget

tar zxvf libiconv-1.14.tar.gz

cd libiconv-1.14

​./configure --prefix=/usr/local/libiconv

make

make install​cd

wget -o /etc/yum.repos.d/epel.repo

ls /etc/yum.repos.d/

​yum install -y libmcrypt-devel

​yum install mhash mhash-devel mcrypt -y

​安裝php-5.3.27

cd /server/tools/

wget 

tar zxvf php-5.3.27.tar.gz

cd php-5.3.27

./configure \

--with-xmlrpc \

--with-openssl \

--with-zlib \

--with-mcrypt \

--with-mhash \

--with-mcrypt \

--with-mhash \

--with-freetype-dir \

--with-gd \

--with-jpeg-dir \

--with-png-dir \

--with-iconv-dir=/usr/local/libiconv \

--enable-short-tags \

--enable-sockets \

--enable-zend-multibyte \

--enable-soap \

--enable-mbstring \

--enable-static \

--enable-gd-native-ttf \

--with-curl \

--with-xsl \

--enable-ftp \

--with-libxml-dir

​make

make install​​

5. lamp整合

​n  安裝完php後檢視apache配置檔案,發現apache已載入php模組

[root@liwenbin etc]# grep libphp5 

loadmodule php5_module        modules/libphp5.so

​n   新增對php解析的支援內容​​

​​n   修改apache的執行使用者

useradd -s /sbin/nologin -m apache​​

user apache

group apache

​n   修改首頁檔案

directoryindex index.php index.html

6.lamp整合測試

n   apache與php整合測試

<?php

phpinfo();

?>

n   apache、mysql與php整合測試

<?php

//$link_id=mysql_connect('主機名','使用者','密碼');

$link_id=mysql_connect("127.0.0.1","root","123456");

if(!empty($link_id))

else

?>

centos快速安裝lamp

使用 yum 安裝 mysql yum install mysql server y 安裝完成後,啟動 mysql 服務 service mysqld restart 設定 mysql 賬戶 root 密碼 usr bin mysqladmin u root password 使用 yum 安裝 a...

linux 快速安裝LAMP教程

最近學習linux,安裝lamp遇到一些問題,記錄下來分享一下 linux apache mysql php perl together commonly known as lamp server.參考blog 一 安裝apache 二 安裝mysql 如遇問題,參考 yum install mys...

linux快速安裝lamp的方法

sudo apt get update 注 sudo apt get update 獲得最近的軟體包的列表 列表中包含一些包的資訊,比如這個包是否更新過 sudo apt get install mysql server 注 sudo apt get install mysql server 命令是...