Linux 安装 LAMP
标签(空格分隔): linux-mysql
虽然mysql官网提供的很多种安装方式,但是我个人还是建议使用这种,这种性能更好,采用yum命令或者apt-get命令安装 不方便更好的管理mysql服务器。
1、下载mysql安装包 到 /usr/local/src
下载地址: http://dev.mysql.com/downloads/mysql/5.5.html#downloads
http://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.51-linux2.6-x86_64.tar.gz
2、解压安装包
tar -zxvf mysql-5.5.51-linux2.6-x86_64.tar.gz
3、移动并重命名
mv mysql-5.5.51-linux2.6-x86_64 /usr/local/mysql
4、创建不能登录的mysql账号
useradd -s /bin/nologin -M mysql
5、安装mysql
mkdir -pv /data/mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
6、拷贝my-large.cnf 到 /etc/my.cnf
cp support-files/my-large.cnf /etc/my.cnf
7、复制 mysql.server 到 /etc/init.d/mysqld 文件
cp support-files/mysql.server /etc/init.d/mysqld
8、添加到系统进程,设置开机启动
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
9、修改mysqld文件
basedir=/usr/local/mysql
datadir=/data/mysql
10、启动mysql
service mysqld start
二、安装apache
说明
安装apache需要安装 apr和apr-util
下载安装 apr 和apr-util
下载地址: http://apr.apache.org/download.cgi
编译: apr
./configure –prefix=/usr/local/apr/
make & make install
编译 : apr-util
./configure –prefix=/usr/local/apr-util/ –with-apr=/usr/local/apr/
make & make install
下载编译apache
下载地址 http://mirrors.cnnic.cn/apache/httpd/
编译:
./configure –prefix=/usr/local/httpd –with-included-apr –enable-so –enable-deflate=shared –enable-expires=shared –enable-rewrite=shared –with-pcre –with-apr=/usr/local/apr/ –with-apr-util=/usr/local/apr-util/
make & make install