http://jingyan.baidu.com/article/19020a0ad09f35529d2842bf.html //vm10安装
http://60808.org/thread-17859-1-1.html //vm安装centoshttp://www.helloswift.com.cn/swiftbase/2014/0608/3096.html //vm安装MAC OS X 10.9http://lspgyy.blog.51cto.com/5264172/1275146 //克隆后网络不能上http://www.linuxidc.com/Linux/2015-10/123845.htm //CentOS 6.5 生产环境编译安装LNMPhttp://www.yimiju.com/articles/601.html //mysql5.7.9安装http://blog.csdn.net/freshlover/article/details/9839867 //不重新编译PHP文件的情况下php GD库扩展库的编译安装(centos)http://blog.csdn.net/zqtsx/article/details/9113261 http://www.linuxidc.com/Linux/2013-06/86188.htmhttp://blog.chinaunix.net/uid-22312037-id-4089710.html //Nginx深入详解之日志http://kongzi68.blog.51cto.com/1432619/1629390 //cmake 错误解决安装扩展http://219.233.26.155/nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gzhttp://219.233.26.155/nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gzLibmcrypt(libmcrypt-2.5.8.tar.gz):http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459http://m.oschina.net/blog/497350 //多版本phphttp://www.ahlinux.com/php/14887.html //xdebughttp://www.we3ew.com/?p=1263 //fastcgihttp://www.lxway.com/99854061.htm //HttpRequest中常见的四种ContentTypehttps://www.zybuluo.com/phper/note/89081 //php-fpm的优化一、环境准备配置防火墙,开启80、3306端口vim /etc/sysconfig/iptables-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80端口通过防火墙-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306端口通过防火墙特别提示:如果这两条规则添加到防火墙配置的最后一行,导致防火墙启动失败,正确的应该是添加到默认的22端口 。/etc/init.d/iptables restart #最后重启防火墙使配置生效4、关闭SELinuxvi /etc/selinux/configurations#SELINUX=enforcing #注释掉#SELINUXTYPE=targeted #注释掉SELINUX=disabled #增加:wq! #保存退出setenforce 0 #使配置立即生效 二、系统约定硬盘分区:50G(/boot 200M /swap 8192M /)+100G(/mnt/soft/)软件源代码包存放位置:/mnt/soft/local/src源码包编译安装位置:/mnt/soft/local/软件名数据库数据文件存储路径/mnt/soft/local/mysql/data/ 三、软件包下载1、下载nginx(目前稳定版):http://nginx.org/download/nginx-1.9.9.tar.gz2、下载pcre (支持nginx伪静态):ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.20.tar.gz3、下载MySQL:http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.9.tar.gz4、下载php:http://cn2.php.net/distributions/php-5.6.17.tar.gz5、下载cmake(MySQL编译工具):http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz6、下载libmcrypt(PHPlibmcrypt模块):http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz7、下载GD库安装包(php页面图片验证码支持):https://github.com/libgd/libgd/releases/download/gd-2.1.0/libgd-2.1.0.tar.gz将以上软件包上传到/mnt/soft/local/src/目录 四、安装编译工具及库文件使用CentOS yum命令一键安装yum install -y make apr* autoconf automake curl curl-devel gcc gcc-c++ gtk-devel zlib-devel openssl openssl-devel \pcre-devel gd kernel keyutils patch perl kernel-headers compat* cpp glibc libgomp libstdc++-devel keyutils-libs-devel \libsepol-devel libselinux-devel krb5-devel libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* \libpng* php-common php-gd gettext gettext-devel ncurses* libtool* libxml2 libxml2-devel patch policycoreutils bison 五、软件安装篇1、安装cmakecd /mnt/soft/local/srctar zxvf cmake-3.4.1.tar.gzcd cmake-3.4.1./configure --prefix=/usr/local/cmakemake #编译make install #安装vim /etc/profile 在path路径中增加cmake执行文件路径export PATH=$PATH:/usr/local/cmake/binsource /etc/profile使配置立即生效2、安装pcrecd /mnt/soft/local/srcmkdir /usr/local/pcre #创建安装目录tar zxvf pcre2-10.20.tar.gzcd pcre2-10.20./configure --prefix=/usr/local/pcre #配置make && make install3、安装libmcryptcd /mnt/soft/local/srctar zxvf libmcrypt-2.5.8.tar.gz #解压cd libmcrypt-2.5.8 #进入目录./configure #配置make #编译make install #安装4、安装gd库cd /mnt/soft/local/srctar zxvf gd-2.0.36RC1.tar.gzcd gd-2.0.36RC1./configure --enable-m4_pattern_allow —prefix=/mnt/soft/local/gd --with-jpeg=/usr/lib --with-png=/usr/lib --with-xpm=/usr/lib --with-freetype=/usr/lib --with-fontconfig=/usr/lib #配置make #编译make install #安装5.安装mysql新增mysql用户组# groupadd mysql新增mysql用户# useradd -r -g mysql mysql新建数据库执行文件目录(后面会把编译好的mysql程序安装到这个目录)# mkdir -p /usr/local/mysql新建文件目录# mkdir -p /home/mysql# # mkdir -p /home/mysql/logs# mkdir -p /home/mysql/temp注意:上面的第3及第4是为了以后将MySQL的数据文件与执行程序文件分离,如果你打算设置到不同的路径,注意修改对应的执行命令和数据库初始化脚本!编辑PATH搜索路径# vi /etc/profile +# 在profile文件末尾增加两行PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATHexport PATH使PATH搜索路径立即生效:# source /etc/profiletar -zxvf mysql-5.7.9.tar.gz
cd mysql-5.7.9检查是否找得到boost类库,没有就安装
#################boost类库####################//5.7需要boost类库,可使用 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> 参数将在指定路径查找,如未找到会指定下载并解压到指定的路径http://219.233.31.120/ncu.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gztar zxvf boost_1_59_0###############################################需要注意CentOS 6.4版操作系统的最小安装完成后,即使没有安装mysql,在/etc目录下也会存在一个my.cnf文件,建议将此文件更名为其他的名字,否则该文件会干扰源码安装的MySQL的正确配置,造成无法启动。修改/etc/my.cnf操作如下:
# mv /etc/my.cnf /etc/my.cnf.bak# 当然也可以删除掉/etc/my.cnf这个文件:# rm /etc/my.cnf 使用cmake源码安装mysql(如果你打算安装到不同的路径,注意修改下面语句中/usr/local/mysql这个路径!)cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_ARCHIVE_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_DATADIR=/home/mysql/data \-DMYSQL_USER=mysql \-DMYSQL_TCP_PORT=3306 \ -DWITH_BOOST=/mnt/soft/local/src/boost_1_59_0
上面的这些复制完,回车,然后就开始cmake的过程,一般时间不会很长。
cmake结束后开始编译源码,这一步时间会较长,请耐心等待。# make安装编译好的程序# make install注意:如果需要重装mysql,在/usr/local/src/mysql-5.7.9在执行下make install就可以了,不需要再cmake和make清除安装临时文件# make clean修改目录拥有者# chown -Rf mysql:mysql /usr/local/mysql# chown -Rf mysql:mysql /home/mysql进入mysql执行程序的安装路径# cd /usr/local/mysql执行初始化配置脚本,创建系统自带的数据库和表(注意路径/home/mysql/data需要换成你自定定义的数据库存放路径)# bin/mysqld --initialize --user=mysql --basedir=/home/mysql --datadir=/home/mysql/dataA temporary password is generated for root@localhost: Q7tlTDeoWu>&#初始化脚本在/usr/local/mysql/support-files下生成了配置文件my.cnf,需要更改该配置文件的所有者: # chown -Rf mysql:mysql /usr/local/mysql注意:(1)Tips:在启动MySQL服务时,会按照一定次序搜索my.cnf,先在/etc目录下找,找不到则会搜索mysql程序目录下是否有my.cnf";(2)需要注意CentOS 6.4版操作系统的最小安装完成后,即使没有安装mysql,在/etc目录下也会存在一个my.cnf文件,建议将此文件更名为其他的名字,否则该文件会干扰源码安装的MySQL的正确配置,造成无法启动。修改/etc/my.cnf操作如下:# mv /etc/my.cnf /etc/my.cnf.bak# 当然也可以删除掉/etc/my.cnf这个文件:# rm /etc/my.cnf(3)如果你需要用于生产环境,不要急着做下面的mysql启动操作。建议把上一步骤中mysql初始化生成的/usr/local/mysql/mysql.cnf删除,然后把你优化好的mysql配置文件my.cnf放到/etc下。(这是我做mysql主从复制和mysql优化的经验!)复制服务启动脚本# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql启动MySQL服务# service mysql start设置开机自动启动服务# chkconfig mysql onps aux |grep mysq* //查看mysql进程
检测下上一步MySQL用户root密码是否生效:[root@yimiju etc]# mysql -u rootERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)——没有密码无法登录,说明密码修改成功了。###如果不行 就mysqld_safe --user=mysql --skip-grant-tables --skip-networking & mysql -u root mysql
[root@yimiju ~]# mysql -u root -p
Enter password: ——这里提示时输入你设置的mysql root帐号密码#登录成功有如下提示:Welcome to the MySQL monitor. Commands end with ; or \g.......方式1
bin/mysqladmin -u root -p password 设置密码 方式2登录并修改MySQL用户root的密码# mysql -u rootmysql> use mysql;mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";mysql> update user set Password = password('123456') where User='root';mysql> flush privileges;mysql> exit; ***常见错误1.pid错误 关闭进程
ps aux | grep mysq* //查看mysql进程
kill -9 进程id2.ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
rm -rf /var/lock/subsys/mysql //删除即可 (可选)运行安全设置脚本,强烈建议生产服务器使用:[root@yimiju ~]# /usr/local/mysql/bin/mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQLSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the currentpassword for the root user. If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none):OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.You already have a root password set, so you can safely answer 'n'.Change the root password? [Y/n] n ---------------这里输入n... skipping.By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] Y ---------------这里输入Y... Success!Normally, root should only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n ---------------这里输入n... skipping.By default, MySQL comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] Y ---------------这里输入Y- Dropping test database...ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist... Failed! Not critical, keep moving...- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] Y ---------------这里输入Y... Success!All done! If you've completed all of the above steps, your MySQLinstallation should now be secure.Thanks for using MySQL!Cleaning up...重启服务器,检测mysql是否能开机自动启动[root@yimiju ~]# reboot6.安装nginx
cd /usr/local/src
groupadd www #添加www组useradd -g www www -s /bin/false #创建nginx运行账户www并加入到www组,不允许www用户直接登录系统tar zxvf nginx-1.4.4.tar.gzcd nginx-1.4.4./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/mnt/soft/local/src/pcre-8.37注意:--with-pcre=/mnt/soft/local/src/pcre2-10.20指向的是源码包解压的路径,而不是安装的路径,否则会报错makemake install/usr/local/nginx/sbin/nginx #启动nginx设置nginx开启启动vi /etc/rc.d/init.d/nginx #编辑启动文件添加下面内容=======================================================#!/bin/bash# nginx Startup script for the Nginx HTTP Server# it is v.0.0.2 version.# chkconfig: - 85 15# description: Nginx is a high-performance web and proxy server.# It has a lot of features, but it's not for everyone.# processname: nginx# pidfile: /var/run/nginx.pid# config: /usr/local/nginx/conf/nginx.confnginxd=/usr/local/nginx/sbin/nginxnginx_config=/usr/local/nginx/conf/nginx.confnginx_pid=/usr/local/nginx/logs/nginx.pidRETVAL=0prog="nginx"# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ ${NETWORKING} = "no" ] && exit 0[ -x $nginxd ] || exit 0# Start nginx daemons functions.start() { if [ -e $nginx_pid ];thenecho "nginx already running...."exit 1fiecho -n $"Starting $prog: "daemon $nginxd -c ${nginx_config}RETVAL=$?echo[ $RETVAL = 0 ] && touch /var/lock/subsys/nginxreturn $RETVAL}# Stop nginx daemons functions.stop() { echo -n $"Stopping $prog: "killproc $nginxdRETVAL=$?echo[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid}reload() { echo -n $"Reloading $prog: "#kill -HUP `cat ${nginx_pid}`killproc $nginxd -HUPRETVAL=$?echo}# See how we were called.case "$1" instart)start;;stop)stop;;reload)reload;;restart)stopstart;;status)status $progRETVAL=$?;;*)echo $"Usage: $prog {start|stop|restart|reload|status|help}"exit 1esacexit $RETVAL=======================================================:wq! #保存退出chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限chkconfig nginx on #设置开机启动/etc/rc.d/init.d/nginx restart #重新启动Nginxservice nginx restart======================================================= 7、安装phpcd /usr/local/srctar -zvxf php-5.5.7.tar.gzcd php-5.5.7../configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-usrimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-jpeg-dir --with-freetype-dirmake #编译
make install #安装cp php.ini-production /usr/local/php5/etc/php.ini #复制php配置文件到安装目录rm -rf /etc/php.ini #删除系统自带配置文件ln -s /usr/local/php5/etc/php.ini /etc/php.ini #添加软链接cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件vi /usr/local/php5/etc/php-fpm.conf #编辑user = www #设置php-fpm运行账号为wwwgroup = www #设置php-fpm运行组为wwwpid = run/php-fpm.pid #取消前面的分号设置 php-fpm开机启动cp /usr/local/src/php-5.5.7/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限chkconfig php-fpm on #设置开机启动vi /usr/local/php5/etc/php.ini #编辑配置文件找到:disable_functions =修改为:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用找到:;date.timezone =修改为:date.timezone = PRC #设置时区找到:expose_php = On修改为:expose_php = OFF #禁止显示php版本的信息找到:short_open_tag = Off修改为:short_open_tag = ON #支持php短标签#php配置进入环境变量
vi /etc/profile 在path路径中增加php执行文件路径export PATH=$PATH:/usr/local/php5/binsource /etc/profile使配置立即生效http://www.cnblogs.com/codebean/archive/2011/05/30/php-cli-argv.html //PHP命令行模式的相关参数详解
五、配置nginx支持php
vi /usr/local/nginx/conf/nginx.conf修改/usr/local/nginx/conf/nginx.conf 配置文件,需做如下修改user www www; #首行user去掉注释,修改Nginx运行组为www www;必须与/usr/local/php/etc/php-fpm.conf中的user,group配置相同,否则php运行出错user www www;worker_processes 1;events { worker_connections 1024;}http { include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65; server { listen 80; server_name localhost; root /data1/www ; index index.html index.php; #charset koi8-r;#access_log logs/host.access.log main;
#location / {
# root html; # index index.html index.htm; #}#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
# error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#location ~ \.php$ { # proxy_pass http://127.0.0.1; #}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one # #location ~ /\.ht { # deny all; #} }}/etc/init.d/nginx restart #重启nginx六、测试篇
cd /usr/local/nginx/html/ #进入nginx默认网站根目录rm -rf /usr/local/nginx/html/* #删除默认测试页vi index.php #新建index.php文件phpinfo();?>:wq! #保存退出chown www.www /usr/local/nginx/html/ -R #设置目录所有者chmod 700 /usr/local/nginx/html/ -R #设置目录权限七、其它说明
服务器相关操作命令service nginx restart #重启nginxservice mysqld restart #重启mysql/usr/local/php/sbin/php-fpm #启动php-fpm/etc/rc.d/init.d/php-fpm restart #重启php-fpm/etc/rc.d/init.d/php-fpm stop #停止php-fpm/etc/rc.d/init.d/php-fpm start #启动php-fpmnginx默认站点目录是:/usr/local/nginx/html/权限设置:chown www.www /usr/local/nginx/html/ -RMySQL数据库目录是:/usr/local/mysql/var权限设置:chown mysql.mysql -R /usr/local/mysql/var八、安全优化
sherwin@rocnic~$ssh root@172.16.134.141root@172.16.134.141's password:Last login: Sat Jan 18 12:11:57 2014 from 172.16.134.1-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory[root@dev01 ~]# localelocale: Cannot set LC_CTYPE to default locale: No such file or directorylocale: Cannot set LC_ALL to default locale: No such file or directoryLANG=en_US.UTF-8LC_CTYPE=UTF-8LC_NUMERIC="en_US.UTF-8"LC_TIME="en_US.UTF-8"LC_COLLATE="en_US.UTF-8"LC_MONETARY="en_US.UTF-8"LC_MESSAGES="en_US.UTF-8"LC_PAPER="en_US.UTF-8"LC_NAME="en_US.UTF-8"LC_ADDRESS="en_US.UTF-8"LC_TELEPHONE="en_US.UTF-8"LC_MEASUREMENT="en_US.UTF-8"LC_IDENTIFICATION="en_US.UTF-8"LC_ALL= 九。不重新编译PHP文件的情况下php GD库扩展库的编译安装(centos)####################(注意如果服务器没有libjpeg等 就去)#################安装 zlibwget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gztar -zxf zlib-1.2.3.tar.gzcd zlib-1.2.3./configure --prefix=/usr/local/zlibmakemake install安装 jpegwget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg.tar.gz 安装前先创建jpeg安装文件所需(如下)目录,防止提示类似“无法创建一般文件‘/usr/local/jpeg/***’: 没有那个文件或目录" 的错误mkdir /usr/local/jpegmkdir /usr/local/jpeg/binmkdir /usr/local/jpeg/libmkdir /usr/local/jpeg/includemkdir /usr/local/jpeg/manmkdir /usr/local/jpeg/man1mkdir /usr/local/jpeg/man/man1tar -zxf jpeg.tar.gzcd jpeg-6b./configure --prefix=/usr/local/jpeg --enable-shared --enable-staticmakemake install安装完成提示:Libraries have been installed in:/usr/local/jpeg6/lib安装 libpng
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gz
tar -zxf libpng-1.2.16.tar.gzcd libpng-1.2.16./configure --prefix=/usr/local/libpngmakemake install安装 freetype
wget http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gztar -zxf freetype-2.3.4.tar.gzcd freetype-2.3.4mkdir -p /usr/local/freetype./configure --prefix=/usr/local/freetypemakemake installgd目录
tar -zxf gd-2.0.33.tar.gzcd gd-2.0.33mkdir -p /usr/local/gd2 ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/libpng/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/makemake install注意:
./configure --with-php-config=[php安装目录]/bin/php-config --with-jpeg=[jpeg-6b安装目录] --with-png=[libpng安装目录] --with-freetype=[freetype安装目录] --with-zlib=[zlib安装目录] --with-gd=[gd安装目录] (如果出现未知配置项--with-png**,--with-freetype之类的错误 在配置项后面加上-dir参数即可:既修编译参数为: ./configure --with-php-config=[php安装目录]/bin/php-config --with-jpeg-dir=[jpeg安装目录] --with-png-dir=[libpng安装目录] --with-freetype-dir=[freetype安装目录] --with-zlib=[zlib安装目录] --with-gd=[gd安装目录] 即可########################################################################以下系统已经有libjpeg 之前yum已经安装过,就执行以下命令了tar -zxf gd-2.0.33.tar.gz
cd gd-2.0.33mkdir -p /usr/local/gd2 ./configure --prefix=/usr/local/gd2 --with-jpeg --with-png --with-zlib --with-freetypemakemake install进入“[php解压目录]/ext/gd”目录,执行如下命令:
cd /mnt/soft/local/src/php-5.6.17/ext/gd[php安装目录]/bin/phpize/usr/local/php5/bin/phpize./configure --with-php-config=/usr/local/php5/bin/php-config --with-gd=/usr/local/gd2 --with-png-dirmake# make成功执行后,生成的扩展库文件在当前目录的 modules 子目录下cp modules/gd.so /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/# 在php.ini的添加扩展库位置,设置要添加的扩展库。
vi /usr/local/php5/etc/php.iniextension=gd.so重启php-fpm 重启nginx 大功告成!!!!
###############################
http://blog.csdn.net/21aspnet/article/details/8203447mcrypt 扩展库用下面命令#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure
#make
#make install
################################
十。安装redis
1.检查安装依赖程序
yum install gcc-c++
yum install -y tclwget http://download.redis.io/releases/redis-2.8.13.tar.gz
tar -xzvf redis-2.8.19.tar.gzmv redis-2.8.19 /usr/local/rediscd /usr/local/redis
make
make installmkdir -p /etc/redis
cp redis.conf /etc/redis/vi /etc/redis/redis.conf
仅修改: daemonize yes (no-->yes)/usr/local/bin/redis-server /etc/redis/redis.conf //启动ps -ef | grep redis
redis-cli //使用客户端
redis-cli shutdown //关闭
2.安装PHPredis扩展wget https://github.com/nicolasff/phpredis/archive/master.zipunzip master.zipcd phpredis-masterphpize./configure --with-php-config=/usr/local/php5/bin/php-configmakemake installvim /etc/php.iniextension=redis.so十一。安装xdebug
wget http://www.xdebug.org/files/xdebug-2.4.0rc3.tgz
cd xdebug-2.4.0rc3/usr/local/php/bin/phpize./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-configmake && make installvi php.ini
加入 : zend_extension=xdebug.so
重启php nginx。
http://www.51testing.com/html/18/170218-3545467.html //配置
http://www.cnblogs.com/dreamhome/p/3218744.html //详解[xdebug]
xdebug.idekey=PHPSTORMxdebug.remote_connect_back = 1 xdebug.remote_host=192.168.31.238xdebug.remote_enable=onxdebug.remote_port = 9060 xdebug.remote_handler = dbgpxdebug.auto_trace = 0xdebug.collect_includes = 1xdebug.collect_params = 1xdebug.collect_return = 1xdebug.default_enable = 1xdebug.collect_assignments = 1xdebug.collect_vars = 1xdebug.remote_autostart = 1xdebug.show_local_vars = 1xdebug.show_exception_trace = 0 ***注意最好把xdebug.auto_trace = 0; 关闭 。如果开启后可能会引发一些小问题,原来的PHP环境会出现链接被重置,把这关闭即可!十二。linux下php添加pdo_mysql扩展
http://www.edbiji.com/doccenter/showdoc/78/nav/1002.html进去到php的源码包的ext中cd /usr/local/src/php-5.2.17/ext/pdo_mysql/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysqlmake && make installextension=pdo_mysql.so十三。安装git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
wget https://www.kernel.org/pub/software/scm/git/git-2.3.0.tar.gztar -zxvf git-2.3.0.tar.gzcd git-2.3.0make prefix=/usr/local/git allmake prefix=/usr/local/git install#配置进入环境变量
vi /etc/profileexport PATH=$PATH:/usr/local/git/binsource /etc/profile使配置立即生效 十四。 BItnami Gitlabhttp://devtian.me/2015/03/05/gitlab-cooperation-tool-1/http://comedsh.iteye.com/blog/2238200http://blog.csdn.net/uniquechao/article/details/41250459下载
wget https://downloads.bitnami.com/files/stacks/gitlab/7.6.2-0/bitnami-gitlab-7.6.2-0-linux-installer.runchmod +x xxx.run
安装./xxx.run----------------------------------------------------------------------------
Welcome to the Bitnami Gitlab Stack Setup Wizard.----------------------------------------------------------------------------Select the components you want to install; clear the components you do not want to install. Click Next when you are ready to continue.GitLab : Y (Cannot be edited)GitLab CI [Y/n] :YIs the selection above correct? [Y/n]: Y----------------------------------------------------------------------------Installation folderPlease, choose a folder to install Bitnami Gitlab StackSelect a folder [/opt/gitlab-7.4.3-0]:----------------------------------------------------------------------------Create Admin accountBitnami Gitlab Stack admin user creationEmail Address [xschao@xxx.com]: Login [xschao]: Password :xxxxxxxxxxxPlease confirm your password :----------------------------------------------------------------------------Hostname that will be used to create internal URLs. If this value is incorrect, you may be unable to access your Gitlab installation from other computers. It is advisable to use a Domain instead of an IP address for compatibility with different browsers.Domain [127.0.0.1]: 这里最好写外网ip或者域名:如192.168.31.176Do you want to configure mail support? [y/N]: y----------------------------------------------------------------------------Configure SMTP SettingsThis is required so your application can send notifications via email.Default email provider:[1] GMail[2] CustomPlease choose an option [1] : 1----------------------------------------------------------------------------Configure SMTP SettingsThis data is stored in the application configuration files and may be visible to others. For this reason, it is recommended that you do not use your personal account credentials.GMail address []: xschao.test@gmail.com GMail password :Re-enter :----------------------------------------------------------------------------Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.Do you want to continue? [Y/n]: Y----------------------------------------------------------------------------Please wait while Setup installs Bitnami Gitlab Stack on your computer. Installing 0% ______________ 50% ______________ 100% 安装完成后用提示的域名进入gitlab 如:http://127.0.0.1:84/ 查看gitlab相关命令 cd /opt/gitlab-xxx/ ./ctlscript.sh usage: ./ctlscript.sh help ./ctlscript.sh (start|stop|restart|status) ./ctlscript.sh (start|stop|restart|status) mysql ./ctlscript.sh (start|stop|restart|status) apache ./ctlscript.sh (start|stop|restart|status) redis ./ctlscript.sh (start|stop|restart|status) gitlab_sidekiq ./ctlscript.sh (start|stop|restart|status) gitlabci_sidekiq ./ctlscript.sh (start|stop|restart|status) gitlabci_runner
help - this screen
start - start the service(s) stop - stop the service(s) restart - restart or start the service(s) status - show the status of the service(s) 如:./ctlscript.sh restart gitlab_sidekiq //重启gitlab ####修改服务器IP地址 假如在安装gitlab的过程中,你全部是按照默认选项安装的,当我们创建一个project的时候,生成的仓库地址是这样的:git@127.0.0.1:username/test.git,这显示是不正确的,因为这个地址是本机地址,而开发人员做git clone操作时,是在自己的电脑上完成的,那么怎么解决这个问题呢?还是要看 gitlab.yml 这个配置文件。 vi /opt/gitlab-7.6.2-0/apps/gitlab/htdocs/config/gitlab.yml 把host: 127.0.0.1 改成host: 192.168.32.166 /opt/gitlab-7.6.2-0/ctlscript.sh restart gitlab_sidekiq //重启gitlab服务 /opt/gitlab-7.6.2-0/ctlscript.sh restart apache //重启apache服务十五。安装confluence http://lschao.blog.51cto.com/7814743/1409970十六。安装seaslog
https://github.com/Neeke/SeasLog#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8seaslogwget https://pecl.php.net/get/SeasLog-1.5.0.tgz
tar zxvf SeasLog-1.5.0.tgzcd SeasLog-1.5.0phpize ./configure --with-php-config=/usr/local/php5/bin/php-configmake && make installvi /etc/php.ini
extension = seaslog.soseaslog.default_basepath = /log/seaslog-test ;默认log根目录seaslog.default_logger = default ;默认logger目录seaslog.disting_type = 1 ;是否以type分文件 1是 0否(默认)seaslog.disting_by_hour = 1 ;是否每小时划分一个文件 1是 0否(默认)seaslog.use_buffer = 1 ;是否启用buffer 1是 0否(默认)seaslog.buffer_size = 100 ;buffer中缓冲数量 默认0(不使用buffer_size)seaslog.level = 0 ;记录日志级别 默认0(所有日志)seaslog.trace_error = 1 ;自动记录错误 默认1(开启)seaslog.trace_exception = 0 ;自动记录异常信息 默认0(关闭) 十七。安装Composerhttp://www.phpcomposer.com/curl -sS https://getcomposer.org/installer | php
cp composer.phar /usr/local/bin/composer#composer config repo.packagist composer http://packagist.phpcomposer.com //该国内镜像
修改当前项目的 composer.json 配置文件,如加入monolog依赖库
{ "require": { "monolog/monolog": "1.5.*" }}执行安装命令
# composer install //需要关闭xdebugcomposer selfupdate //保持composer最新
###如果碰到he Process class relies on proc_open, which is not available on your PHP installation. 错误配置php.ini文件 让其支持 proc_open、proc_get_status函数
http://www.jianshu.com/p/072e09734ffc //laravel介绍