【php精品源码栏目提醒】:网学会员php精品源码为您提供LINUX下的LAMP编译安装(apache+php+mysql) - 其它资料参考,解决您在LINUX下的LAMP编译安装(apache+php+mysql) - 其它资料学习中工作中的难题,参考学习。
CentOS 5.7X64下编译安装 LAMP 平台
源码包编译安装位置prefix /usr/local/src1、移除系统自带的 rpm 包的 http mysql phpyum remove httpd mysql mysql-server
php php-cli
php-common
php-devel
php-gd -y2 安装必备的开发包yum -y install ntp vim-enhanced gcc gcc-c flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel3 yangr 权限配置,为了系统的安装生产环境下一般为普通用户配置 yangr 权限,进行系统管理useradd baison //创建 baison 用户passwd baison //为 baison 用户设置密码rpm -q yangr //确认软件包安装viyangr //在配置文件最后一行添加下面一行,授予 baison 用户具有管理员权限baison ALLALL ALL保存退出我们一般登录系统进行维护的时候不适用 root,防止权限过大误操作造成系统数据丢失,所以我们一般使用普通用户登录系统,然后需要 root 权限加上 yangr 就会有 root 权限su – baison //切换 baison 用户进行编译安装4同步系统时间:yangr vim /etc/ntp.conf //添加下面三行内容(19行下面添加)server 3.cn.pool.ntp.orgserver 3.asia.pool.ntp.orgserver 0.asia.pool.ntp.orgyangr /sbin/service ntpd stopyangr /usr/sbin/ntpdate cn.pool.ntp.org //更新时间yangr /sbin/service ntpd startyangr /sbin/chkconfig ntpd on5 Install mysql 编译安装 mysql 编译环境前提mysql 5.5.x 不再用 configure而用 cmakecd /usr/local/srcwget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz tar xvf cmake-2.8.4.tar.gz cd cmake-2.8.4 ./configureyangr makeyangr make installcd /usr/local/src tar zxvf mysql-5.5.23.tar.gz cd mysql-5.5.23 cmake -DCMAKE_INSTALL_PREFIX/usr/local/mysql -DMYSQL_DATADIR/data/mysql/data -DWITH_MYISAM_STORAGE_ENGINE1 -DWITH_INNOBASE_STORAGE_ENGINE1 -DWITH_ARCHIVE_STORAGE_ENGINE1 -DWITH_BLACKHOLE_STORAGE_ENGINE1 -DENABLED_LOCAL_INFILE1 -DDEFAULT_CHARSETutf8 -DDEFAULT_COLLATIONutf8_general_ci -DEXTRA_CHARSETSall -DMYSQL_TCP_PORT3306 yangr make yangr make installmysql 配置 userdel -r mysql yangr groupadd -g 3306 mysql yangr useradd -u 3306 -g mysql -M -s /sbin/nologin mysql yangr mkdir -p /data/mysql/data yangr mkdir -p /data/mysql/log yangr chown -R mysql:mysql /data/mysql yangr chmod -R 755 /data/mysql yangr cp support-files/my-medium.cnf /etc/my.cnf yangr /usr/local/mysql/scripts/mysql_install_db --usermysql --basedir/usr/local/mysql--datadir/data/mysql/data //初始化数据库 yangr cp support-files/mysql.server /etc/init.d/mysqld chmod x /etc/init.d/mysqld yangr /sbin/chkconfig --add mysqld yangr /sbin/chkconfig mysqld on yangr /sbin/service mysqld start netstat -tnulp grep 3306 cd /usr/local/bin //进入用户的默认搜索路径下建立 mysql 命令的软连接,可以直接执行 mysql 命令 yangr ln -s /usr/local/mysql/bin/mysql mysql yangr ln -s /usr/local/mysql/bin/mysqldump mysqldump yangr ln -s /usr/local/mysql/bin/mysqladmin mysqladmin mysqladmin -u root -p password 123456 //设置数据库密码 mysql -u root -p mysql flush privilegesyangr vim /etc/my.cnf //Mysql 优化,在mysqld配置参数下面添加下面几行大概37行下面根据服务器不同配置进行不同的设置max_allowed_packet 500M //先找到这行内容,修改成500innodb_file_per_tablelog-bin-trust-function-creators1skip-name-resolv//禁用 DNS 解析sync-binlog1lower_case_table_names1max_connections 1500 默认100log-error/data/mysql/log/mysql.err.log //指定错误日志位置max_heap_table_size 256Mjoin_buffer_size 128Mthread_cache_size 1200 //线程缓存thread_concurrency 4 //设置成 cpu 数 x2,只有一个设置2thread_stack 256Kquery_cache_type 1 //指定是否使用查询缓冲,可以设置为0、1、2,该变量是 SESSION 级的变量query_cache_size 512M //查询缓冲大小query_cache_limit 4M //单个查询缓冲大小。
默认1Mquery_cache_min_res_unit 4k //指定分配缓冲区空间的最小单位,缺省为4Ktmp_table_size 256Mmyisam_sort_buffer_size 64Mback_log 1024//设定缓存队列数,节省连接开销long_query_time 3open_files_limit 10240interactive_timeout 120wait_timeout 120external-locking FALSE//禁用文件系统外部锁table_cache 1024//高速缓存大小,4G 内存设置为2048修改配置文件里下面的参数,去掉前面的innodb_buffer_pool_size 2048M (默认16M,可以为系统内存5070)innodb_additional_mem_pool_size 256M (默认2M)innodb_log_file_size 512M (默认5M,innodb_buffer_pool_size 的四分之一)innodb_log_buffer_size 16M //设置位每秒的数据量innodb_max_dirty_pages_pct 90innodb_file_io_threads 4innodb_thread_concurrency 16innodb_flush_log_at_trx_commit 0innodb_flush_methodO_DIRECTinnodb_open_files4096innodb_lock_wait_timeout 120innodb_file_per_table1:wq //保存退出yangr rm -rvf /data/mysql/data/ib_logfile //删除原来的默认文件yangr /sbin/service mysqld restart netstart -tnlp grep 3306检查是否有 mysql 的3306端口6、apache 安装cd /usr/local/srctar xvf httpd-2.2.22.tar.gzcd httpd-2.2.22./configure --prefix/usr/local/apache --enable-so --enable-rewrite --enable-mods-sharedmostyangr makeyangr make installyangr /usr/local/apache/bin/apachectl startyangr netstat -tnlp grep httpdyangr cp /usr/local/apache/bin/apachectl /etc/init.d/httpdyangr /sbin/service httpd startnetstat -tnlp grep 80yangr vim /etc/init.d/httpd 第二行添加注释信息,添加为系统服务) chkconfig: 35 61 61 description: Apache:wq 保存退出yangr /sbin/chkconfig --add httpd yangr /sbin/chkconfig httpd on安装 PHPcd /usr/local//srctar xvf
php-5.3.10.tar.gzcd
php-5.3.10 yangr ./configure --prefix/usr/local/
php --mandir/usr/local/share/man --infodir/usr/local/share/info --with-apxs2/usr/local/apache/bin/apxs --enable-cgi --with-mysql/usr/local/mysql/ --with-config-file-path/usr/local/
php/etc --with-pdo-mysql/usr/local/mysql --with-mysqli/usr/local/mysql/bin/mysql_config --enable-zip --enable-sqlite-utf8 -enable-sockets --enable-soap --enable-pcntl --enable-mbstring --enable-intl --enable-calendar --enable-bcmath --enable-exif --with-mcrypt --with-mhash --with-gd --with-png-dir --with-jpeg-dir --with-freetype-dir --with-libxml-dir --with-curl --with-curlwrappers --with-zlib --with-openssl --with-kerberosshared --with-gettextshared --with-xmlrpcshared(--with-xsl)yangr makeyangr make installyangr cp
php.ini- production /usr/local/
php/etc/
php.ini //拷贝配置文件整合 Apache 与
PHP 及系统初始化配置yangr vim /usr/local/apache/conf/httpd.conf查找 AddType application/x-gzip .gz .tgz在该行下面添加 !!AddType application/x-httpd-
php .
php 空格!!查找 DirectoryIndex index.html 把该行修改成DirectoryIndex index.html index.htm index.
php:wq 保存退出测试 apache 和
php 是否整合成功下面我们测试 apache 和
php 是否整合成功,在 apache 文档根目录下新建一个小小的
php 程序 cd /usr/local/apache/htdocs yangr vi index.
php //在 index.
php 文件中写入下面三行重启 apache 服务yangr /sbin/service httpd restart访问,在浏览器中输入 http://localhostip 地址/index.
php 出现
php 信息界面则说明整合成功elinks http://localhost/index.
php成功的页面Mysql 授权1 mysql grant all privileges on . to efast identified by efastQuery OK 0 rows affected 0.06 secmysql flush privilegesQuery OK 0 rows affected 0.02 sec2 导入 efast 数据库3 修改 efast 配置文件vim efast/data/config.phpdb_server mysql// database hostdb_host 192.168.175.222// database namedb_name efast// database usernamedb_user efast// database passworddb_pass efast加密狗安装过程cd /usr/local/binln -s /usr/local/webserver/
php/bin/
php-config 创建一个
php-config 的软连接接下来配置加密狗1 先安装 usb 驱动把 usb_doemon 和 baison-so 二个目录上传到/home/baison/srccd /home/baison/src/usb_daemonyangr bash sud_install.sh 。
。
。
。
。
中间是安装信息,直接按 q 退出Do you Agree with the Licensey/n: //这里按 y2 安装加密狗驱动cd /home/baison/src/baison/baison/makemake extfile baison.so //查看编译驱动的属性下面拷贝编译好的模块到
php 的加载模块下面yangr cp baison.so /usr/local/webserver/
php/lib/
php/extensions/no-debug-non-zts-20060613/cd /home/baison/src/baison/test/make test./test //查看锁是否正常/opt/safenet_sentinel/common_files/sentinel_usb_daemon/load_daemon.sh status //查看加密驱动有没有安装yangr vim /usr/local/
php/etc/
php.ini //修改
php 配置文件,添加 baison.so 模块,让
php 加载这个模块extensionbaison.so:wqyangr /sbin/service httpd restart //重启 apachephp -m less //查看
php 是否加载了加密狗驱动
上一篇:
字符串匹配程序
下一篇:
加强公路工程施工技术管理工作的措施