编译安装lamp
来源:互联网 发布:星际淘宝网下载 编辑:程序博客网 时间:2024/05/01 17:37
#编译安装lamp
前几天买了阿里云上centos的服务器, 就在上面搭建了lamp. 是用ssh 连过去的,一点都没有图形页面, aliyun 提供的yum仓库里的版本不是很高, 所以整个过程都是编译安装的, 也受益匪浅, 特写此博客.
安装apache
apache相关文件
pcre-8.37.tar.gz [http://nchc.dl.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz]
apr-util-1.5.4.tar.gz [http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz]
apr-1.5.2.tar.gz [http://apache.fayea.com//apr/apr-1.5.2.tar.gz]
httpd-2.4.17.tar.gz [http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.17.tar.gz]
$ tar -zxvf “包名” -C /usr/local/src
安装apr
$ cd /usr/local/src/apr-1.5.2$ ./configure --prefix=/usr/local/apr $ make$ make install
安装apr-util
$ cd ../apr-util-1.5.4$ ./configure --prefix=/usr/local/apr-util \ --with-apr=/usr/local/apr/bin/apr-1-config$ make$ make install
安装pcre
$ cd ../pcre-8.37/$ ./configure --prefix=/usr/local/pcre \ --with-apr=/usr/local/apr/bin/apr-1-config$ make$ make install
安装httpd
$ cd ../httpd-2.4.17/$ ./configure --prefix=/usr/local/apache2 \ --with-apr=/usr/local/apr/bin/apr-1-config \ --with-apr-util=/usr/local/apr-util/bin/apu-1-config \ --with-pcre=/usr/local/pcre/bin/pcre-config \ --enable-dav \ --enable-so$ make$ make install
加入service
$ cp /usr/local/apache/bin2/apachectl /etc/rc.d/init.d/httpd$ vim /etc/rc.d/init.d/httpd
在文件头加入
# Comments to support chkconfig on RedHat Linux# chkconfig: 2345 90 90# description:http serverchkconfig --add httpdchkconfig --level 345 httpd on
配置apache
$ vim /usr/local/apache2/config/httpd.conf
- 修改ServerName
ServerName localhost:80
- 修改为可访问
<Directory />AllowOverride allRequire all granted</Directory>
- 修改 documentroot
DocumentRoot "/var/www"<Directory "/var/www">Options Indexes FollowSymLinksAllowOverride AllRequire all granted</Directory>
安装mysql5.7
卸载旧版本
rpm
- 安装 : rpm -ivh
- 卸载 : rpm -e –nodeps
- 检查 : rpm -qa
卸载
$ rpm -e --nodeps mysql-5.1.73-5.el6_6.i686$ rpm -e --nodeps mysql-server-5.1.73-5.el6_6.i686$ rpm -e --nodeps mysql-lib-5.1.73-5.el6_6.i686$ rm -fr /usr/lib/mysql $ rm -fr /usr/include/mysql$ rm -f my.cnf $ rm -fr /var/lib/mysql
安装
$ groupadd mysql$ useradd -r -g mysql -s /bin/false mysql$ cd /usr/local$ tar -zxvf /path/to/mysql-VERSION-OS.tar.gz # -C 指定路径$ ln -s full-path-to-mysql-VERSION-OS mysql #ln -s "源文件" "链接文件"$ cd mysql$ mkdir mysql-files$ chmod 770 mysql-files$ chown -R mysql .$ chgrp -R mysql .$ bin/mysql_install_db --user=mysql # Before MySQL 5.7.6$ bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up 此时会提示root的密码(最后一行) 一定要记住.$ bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up$ chown -R root .$ chown -R mysql data mysql-files
修改配置(不然进不去)
$ cp support-files/my-default.cnf /etc/my.cnf #移动默认配置到/etc 并命名为my.cnf
Next command is optional
$ cp support-files/mysql.server /etc/init.d/mysql.server # 添加到 service$ vim /etc/profile # 设置到环境变量
在最后加上
MYSQL_HOME=/usr/local/mysql/bin export PATH=$PATH:$MYSQL_HOME source /etc/profile # 使环境生效 chkconfig --add mysql.server #开机自启 chkconfig -list #看开服务状态 chkconfig --level 345 mysql on #如果3,4,5没有开 手动设置
启动
$ service mysql.server start # 启动 sql-server
安装php 5.6.15
解压 进入
$ ./configure --prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--with-mysql=/usr/local/mysql \--with-mysqli=/usr/local/mysql/bin/mysql_config \--with-apxs2=/usr/local/apache2/bin/apxs \--with-libxml-dir=/usr/local/libxml2 \--with-zlib-dir \--with-curl --with-bz2 \--with-gd \--enable-gd-native-ttf \--with-png-dir=/usr/lib \--with-jpeg-dir=/usr/lib \--with-freetype-dir=/usr/lib \--with-gettext --with-openssl \--with-fpm-user=www --with-fpm-group=www \--with-gmp \--with-mhash \--enable-calendar \--enable-ftp \--enable-zip \--enable-pdo \--enable-bcmath \--enable-shmop \--enable-mbstring \--enable-sockets \--enable-fpm \--enable-inline-optimization \--enable-sigchild \--enable-sysvsem \--enable-sysvshm
如果出现 not find xml-config
$ yun install libxml$ yun install libxml-devel -y$ find / -name "xml-config" #找到就好
如果出现 not find libmysqlclient_r.so
$ find / -name "libmysqlclient*" #找到 libmysqlclient$ ln -s libmysqlclient.so.20.0.9 libmysqlclient_r.so$ make$ make test #测试 (我的结果见 附录 phptest 结果)$ make install
配置文件
$ cp php.ini-development /usr/local/php/lib/php.ini
配置apache的php支持
$ vim /usr/local/apache2/config/httpd.conf
;LoadModule php5_module ;modules/libphp5.so###去掉 ;LoadModule php5_module modules/libphp5.so
在<IfModule mime_module>
下加入
AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps
0 0
- LAMP 安装编译参数
- CentOS编译安装lamp
- Linux编译安装LAMP
- lamp编译安装
- CentOS编译安装lamp .
- LAMP 编译安装
- 编译安装lamp详解
- Linux编译安装LAMP
- centos编译安装lamp
- 编译安装lamp环境
- linux编译安装LAMP
- LAMP漫长编译安装
- lamp环境编译安装
- 编译安装lamp环境
- 编译安装lamp
- 编译安装LAMP(一)
- lamp编译安装
- 源码编译安装LAMP
- 自定义鼠标修改窗口大小
- RecyclerView的使用
- 图形处理(十)测地极坐标参数化
- 精华阅读第 5 期 | 移动开发精英俱乐部
- leetcode3. Longest Substring Without Repeating Characters
- 编译安装lamp
- ios实时播放PCM数据
- socket编程
- LINK:fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- 16进制颜色码对照表
- session会话更新
- 修改textfield的左右视图的位置。
- 完全背包
- 图形处理(十一)Stroke Parameterization