标签:ext 格式 gre 命令 prefix kconfig app yum安装 ml2
这里介绍的LAMP架构是由Linux、Apache、MySQL、PHP组成的。yum -y install gcc gcc-c++ make pcre-devel expat-devel perl
tar zvxf apr-1.6.2.tar.gz -C /opt
tar zvxf apr-util-1.6.0.tar.gz -C /opt
tar zvxf httpd-2.4.29.tar.gz -C /opt
cd /opt
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
cd /opt/httpd-2.4.29
cd httpd-2.4.29
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
make && make install
vi /usr/local/httpd/conf/httpd.conf
//修改如下内容
ServerName www.yun.com:80
Listen 192.168.100.131:80
创建配置文件的链接到etc目录下
ln -s /usr/local/httpd/conf/httpd.conf /etc/
创建httpd服务脚本
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
# chkconfig: 35 85 21 //35级别自动运行 第85个启动 第21个关闭
# description: Apache is a World Wide Web server
chkconfig --add httpd //将httpd加入到SERVICE管理器
方便系统识别httpd命令,创建链接。
ln -s /usr/local/httpd/bin/* /usr/local/bin/
httpd -t
apachectl -t
service httpd start
netstat -anpt | grep 80 //查看80端口开启
yum install -y ncurses-devel autoconf cmake
tar xzvf mysql-5.6.26.tar.gz
cd mysql-5.6.26
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DSYSCONFIDIR=/etc -DMYSQL_DATADIR=/home/mysql/ -DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock
make && make install
useradd -s /sbin/nologin mysql
chown -R mysql:mysql /usr/local/mysql/ //设置属性
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
echo $PATH
cd mysql-5.6.26
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
创建sock文件的链接
ln -s /var/lib/mysql/mysql.sock /home/mysql/mysql.sock
编辑启动脚本并加入系统服务
vi /etc/init.d/mysqld
basedir=/usr/local/mysql //数据库安装路径
datadir=/home/mysql //数据库数据存放路径
chmod 755 /etc/init.d/mysqld
chkconfig --add /etc/init.d/mysqld
chkconfig mysqld --level 35 on
/usr/local/mysql/scripts/mysql_install_db --user=mysql --ldata=/var/lib/mysql --basedir=/usr/local/mysql --datadir=/home/mysql
service mysqld start
netstat -anpt | grep 3306
mysqladmin -u root -p password "abc123" //给root账号设置密码
yum -y install gd libpng libpng-devel pcre pcre-devel libxml2-devel libjpeg-devel
tar xjvf php-5.6.11.tar.bz2
cd php-5.6.11
./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5 --enable-mbstring
make && make install
cp php.ini-development /usr/local/php5/php.ini
ln -s /usr/local/php5/bin/* /usr/local/bin/
ln -s /usr/local/php5/sbin/* /usr/local/sbin/
vi /etc/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
service httpd restart
vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
在网页测试“http://192.168.100.131/index.php”
mysql -u root -p
CREATE DATABASE sky;
GRANT all ON sky.* TO ‘skyuser‘@‘%‘ IDENTIFIED BY ‘admin123‘;
flush privileges
vi /usr/local/httpd/htdocs/index.php
<?php
$link=mysql_connect(‘192.168.175.130‘,‘skyuser‘,‘admin123‘);
if($link) echo "<h1>Success!!</h1>";
else echo "Fail!!";
mysql_close();
?>
在网页测试“http://192.168.100.131/index.php”
标签:ext 格式 gre 命令 prefix kconfig app yum安装 ml2
原文地址:http://blog.51cto.com/11134648/2150371