menu linbiwei
account_circle

正在努力加载中QAQ

vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
date_range 2019-03-06 14:27
apps linux
local_offer 查看标签
comment 1 条评论
浏览:422

安装前准备

vmware下载地址
centos6.5_x86_64下载地址

vmware安装自己百度或者谷歌下载安装或者用我上面提供的下载地址,我用的是12.1.0版本的vmware

安装

点击虚拟机右上角的文件—>新建虚拟机
—>典型(推荐)—>下一步
—>选稍后安装系统—>下一步
—>选linux对应版本为centos64位—>下一步
—>给虚拟机命名(随意)和所安装的路径(这里建议建个文件夹搞)—>下一步
—>设置最大磁盘大小(我设置了80G)选将磁盘拆分成多个文件—>下一步
—>点自定义硬件—>设置内存(根据自己电脑设置我设置了3G)
设置CD/DVD选右边的使用ISO映像文件找到下载的文件(我用的是CentOS-6.5-x86_64-minimal.iso)
—>关闭—>完成

开启虚拟机

vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
回车
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
这里记得用tab键切换到Skip然后回车
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
下一步
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
下一步
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
下一步
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
下一步
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
暂时用默认主机名点下一步
vwamre12.1.0-centos6.5_x86_64-install-nginx1.12.2-mysql5.6.22-php5.6.36
下一步
接着设置登录密码
下一步
选创建自定义布局
下一步
创建—>标准分区—>创建—>挂载点填/boot然后其它默认—>确定
创建—>标准分区—>创建—>文件系统类型选swap大小填2048然后其它默认—>确定
创建—>标准分区—>创建—>挂载点填/其它大小选项选使用全部可用空间然后其它默认—>确定
下一步—>格式化—>将修改写入磁盘—>默认设置—>下一步—>最后等待安装完成—>点重新引导

配置静态ip访问外网

安装完虚拟机之后,检查网络连接下的VMnet1和VMnet8是否存在,如果不存在可以在虚拟机界面 编辑—>虚拟网络编辑器—>还原默认配置
然后设置虚拟机桥接模式,在电脑本机cmd界面输入ipconfig查看本机的ip假设为192.168.137.59
接着进到centos虚拟机命令行界面输入ifconfig会发现只有lo少了网卡eth0上不了网,解决办法配置静态ip,操作如下:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
会看到如下配置其中写着修改和添加表示改动过和新增的
DEVICE=eth0
HWADDR=00:0C:29:B4:21:3B
TYPE=Ethernet
UUID=b1635b78-bf89-4b9e-b598-450ac33797a8
ONBOOT=yes 修改
NM_CONTROLLED=no 修改
BOOTPROTO=static 修改
IPADDR=192.168.137.130 添加(这里根据电脑本机设置同一网段)
NETMASK=255.255.255.0 添加(子网掩码)
GATEWAY=192.168.137.1 添加(网关)
配置完后esc然后英文状态下:wq保存退出
重启网络服务 service network restart
接着vi /etc/resolv.conf
添加如下dns
nameserver 8.8.8.8
nameserver 8.8.4.4
然后ping www.baidu.com这回可以上网了,完美~
接下来就可以使用xshell连接虚拟机里面的centos
如果xshell时不时中断
可以编辑vi /etc/sysconfig/network-scripts/ifcfg-eth0修改下ip
然后通过vi /etc/ssh/sshd_config
找到ClientAliveInterval和ClientAliveCountMax 
去掉#配置如下
ClientAliveInterval 60 
ClientAliveCountMax 3
重启sshd服务
service sshd restart 或者/etc/init.d/sshd restart

修改虚拟机主机名

有三种方式:
第一种直接用hostname命名
hostname linbiwei
第二种编辑network
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=linbiwei(根据自己喜欢的名称设置)
第三种编辑hosts(我一般使用这种)
vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

127.0.0.1 linbiwei
192.168.137.130 linbiwei
注:(这里192.168.137.130根据上面设置的DHCP起始ip范围自己设置)
重启reboot

nginx-1.12.2安装准备

我使用的安装包是nginx-1.12.2.tar.gz
可以去这里下载

[root@linbiwei ~]# pwd
/root
[root@linbiwei ~]# cd /
[root@linbiwei /]# ll
[root@linbiwei /]# mkdir software
[root@linbiwei /]# cd software
[root@linbiwei software]# yum -y install wget
如果安装包已经下载好可以用工具SSH Secure File Transfer Client上传
如果还没下载可以用wget http://nginx.org/download/nginx-1.12.2.tar.gz下载
关闭防火墙
[root@linbiwei software]# service iptables status
[root@linbiwei software]# service iptables stop   临时关闭防火墙
[root@linbiwei software]# chkconfig iptables off  永久关闭防火墙
[root@linbiwei software]# service iptables status
iptables:未运行防火墙。
关闭SElinux
[root@linbiwei software]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@linbiwei software]# setenforce 0
[root@linbiwei software]# useradd www -s /sbin/nologin
[root@linbiwei software]# yum -y install pcre pcre-devel zlib zlib-devel gcc-c++ gcc openssl*
[root@linbiwei software]# tar zxvf nginx-1.12.2.tar.gz 
[root@linbiwei software]# cd nginx-1.12.2/
[root@linbiwei nginx-1.12.2]# ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module  --with-pcre
[root@linbiwei nginx-1.12.2]# make && make install
接下来浏览器访问ip地址就可以看到Welcome to nginx!
注:如果不能访问接着下面的nginx添加系统服务操作步骤完成后一般就可以正常访问

nginx添加到系统服务

设置nginx到系统服务
vi /etc/init.d/nginx 
添加如下脚本
开始
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# this script create it by caffreyxin at 2007.10.15.
# it is v.0.0.1 version.
# if you find any errors on this scripts, please contact caffreyxin.
# and send mail to xinyflove at sina dot com.
#
# 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.conf

nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid

RETVAL=0
prog="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 ];then
        echo "nginx already running...."
        exit 1
    fi

    echo -n $"Starting $prog: "
    daemon $nginxd -c ${nginx_config}
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
    return $RETVAL
}


# Stop nginx daemons functions.
stop() {
    echo -n $"Stopping $prog: "
    killproc $nginxd
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}


# reload nginx service functions.
reload() {

    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo

}

# See how we were called.
case "$1" in
start)
        start
        ;;

stop)
        stop
        ;;

reload)
        reload
        ;;

restart)
        stop
        start
        ;;

status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac

exit $RETVAL

结束
脚本中的
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
这三个路径一般按照我上面的操作不用改

[root@linbiwei nginx-1.12.2]# chmod 755 /etc/init.d/nginx
[root@linbiwei nginx-1.12.2]# chkconfig nginx on  设置开机自启
[root@linbiwei nginx-1.12.2]# chkconfig --list    查看开机启动的服务
[root@linbiwei nginx-1.12.2]# service nginx restart 重启nginx
[root@linbiwei nginx-1.12.2]# service nginx stop 停止nginx
[root@linbiwei nginx-1.12.2]# service nginx start 开启nginx

mysql-5.6.22安装准备

我使用的安装包是mysql-5.6.22.tar.gz
可以去这里下载

[root@linbiwei software]# rpm -qa | grep mysql 
mysql-libs-5.1.71-1.el6.x86_64
查看是否有安装mysql服务,因为mysql-libs-5.1.71-1.el6.x86_64是 MySQL 的必要包,没有 MySQL 服务,因此没必要卸载
如果需要删除可以使用rpm -e mysql 普通删除模式或者yum remove mysql mysql-* 删除
修改防火墙设置开启3306端口
[root@linbiwei software]# vi /etc/sysconfig/iptables 
添加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT 
以下是所有的配置
开始
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT 新增
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
结束
[root@linbiwei software]# service iptables restart 重启防火墙生效这里有个坑,会发现访问不了nginx
[root@linbiwei software]# service iptables stop 
[root@linbiwei software]# chkconfig iptables off
解决nginx访问不了
[root@linbiwei software]# groupadd mysql  新增mysql用户组
[root@linbiwei software]# useradd -r -g mysql mysql 新增 mysql 用户并添加到 mysql 用户组
[root@linbiwei software]# mkdir -p /usr/local/mysql 新建mysql 执行文件目录
[root@linbiwei software]# mkdir -p /home/mysql/data 新建mysql数据文件目录
[root@linbiwei software]# mkdir -p /home/mysql/logs 新建mysql日志文件目录
[root@linbiwei software]# mkdir -p /home/mysql/temp 新建mysql缓存文件目录
这里的数据文件目录、日志文件目录、缓存文件目录可以自定义、执行文件目录一般用/usr/local/mysql 个人感觉比较规范
[root@linbiwei software]#  vi /etc/profile 
在最后一行添加者两行
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
[root@linbiwei software]# source /etc/profile 使其生效
 安装mysql需要的依赖包
[root@linbiwei software]# yum install make cmake gcc gcc-c++ bison bison-devel  ncurses ncurses-devel  autoconf  automake
[root@linbiwei software]# tar -zxvf mysql-5.6.22.tar.gz
[root@linbiwei software]# ll
[root@linbiwei software]# cd mysql-5.6.22
使用cmake源码安装mysql这里需要注意的是两个参数DCMAKE_INSTALL_PREFIX和DMYSQL_DATADIR对应的mysql创建的执行目录路径和数据目录要写对
[root@linbiwei mysql-5.6.22]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -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  -DENABLE_DOWNLOADS=1
[root@linbiwei mysql-5.6.22]# make
[root@linbiwei mysql-5.6.22]# make install
[root@linbiwei mysql-5.6.22]# make clean
修改 mysql 目录拥有者为 mysql 用户
[root@linbiwei mysql-5.6.22]# chown -Rf mysql:mysql /usr/local/mysql 
[root@linbiwei mysql-5.6.22]# chown -Rf mysql:mysql /home/mysql
进入mysql执行目录
[root@linbiwei mysql-5.6.22]#  cd /usr/local/mysql
[root@linbiwei mysql]# pwd
/usr/local/mysql
[root@linbiwei mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/home/mysql/data 初始化脚本生成my.cnf
[root@linbiwei mysql]# chown -Rf mysql:mysql /usr/local/mysql
[root@linbiwei mysql]# vi my.cnf
在sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES之上添加
开始
[client]
port=3306
#socket=/usr/local/mysql/mysql.sock
socket=/tmp/mysql.sock
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci


skip-external-locking
skip-name-resolve


user=mysql
port=3306
basedir=/usr/local/mysql
datadir=/home/mysql/data


#server_id=...
#socket=/usr/local/mysql/mysql.sock
socket=/tmp/mysql.sock
log-error=/home/mysql/logs/mysql_error.log
pid-file=/home/mysql/mysql.pid


open_files_limit=10240


back_log=600
max_connections=500
max_connect_errors=6000
wait_timeout=605800
#open_tables=6000
#table_cache=650
#opened_talbes=630


max_allowed_packet=32M


sort_buffer_size=4M
join_buffer_size=4M
thread_cache_size=300
query_cache_type=1
query_cache_size=256
query_cache_limit=2M
query_cache_min_res_unit=16K


tmp_table_size=256M
max_heap_table_size=256M


key_buffer_size=256M
read_buffer_size=1M
read_rnd_buffer_size=16M
bulk_insert_buffer_size=64M


lower_case_table_names=1
default-storage-engine=INNODB


innodb_buffer_pool_size=1024
innodb_log_buffer_size=32M
innodb_log_file_size=128M
innodb_flush_method=O_DIRECT


##########################
thread_concurrency=32
long_query_time=2
slow-query-log=on
slow-query-log-file=/home/mysql/logs/mysql-slow.log


[mysqldump]
quick
max_allowed_packet=32M


[mysql_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
结束
脚本中的innodb_buffer_pool_size=1024这个值根据设置为内存的三分之一或三分之二即可
[root@linbiwei mysql]# cd /etc
[root@linbiwei etc]# ll  查看是否有my.cnf
[root@linbiwei etc]# rm -rf my.cnf  将其删除主要是我想直接在mysql执行目录设置my.cnf软链接到etc目录
[root@linbiwei mysql]# ln -s /usr/local/mysql/my.cnf /etc/my.cnf
[root@linbiwei mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 复制启动脚本到/etc/init.d目录
[root@linbiwei mysql]#  service mysql start  启动mysql服务
如果出现以下错误
Starting MySQL.. ERROR! The server quit without updating PID file (/home/mysql/mysql.pid).
是因为/home/mysql这个目录之前设置目录拥有者为mysql没有成功
使用chown -Rf mysql:mysql /home/mysql 解决后再执行service mysql start
[root@linbiwei mysql]# chkconfig mysql on
[root@linbiwei mysql]# mysqladmin -u root password 'xxx' 设置数据库密码为xxx
mysql -uroot -p
填写xxx密码
show databases;
use mysql;
update user set password=password('root') where user='xxx'; 修改密码sql
flush privileges; 刷新权限
设置远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH  GRANT OPTION; 允许root远程访问数据库
flush privileges; 刷新权限

php-5.6.36

我使用的安装包是php-5.6.36.tar.gz
可以去这里下载

[root@linbiwei software]# yum install gcc-c++ gd libxml2-devel libjpeg-devel libpng-devel net-snmp-devel curl-devel libxslt-devel pcre-devel libjpeg libpng libxml2 libcurl4-openssl-dev libcurl-devel libcurl freetype-config freetype freetype-devel unixODBC libxslt -y
[root@linbiwei software]# tar -zxf php-5.6.36.tar.gz
[root@linbiwei software]# cd php-5.6.36
[root@linbiwei php-5.6.36]# ./configure --prefix=/usr/local/php --with-curl --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysql --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-freetype-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml
[root@linbiwei php-5.6.36]# make && make install
[root@linbiwei php-5.6.36]# cp -a /software/php-5.6.36/php.ini-production /usr/local/php/etc/php.ini
[root@linbiwei php-5.6.36]# ln -s /usr/local/php/etc/php.ini /etc/php.ini
[root@linbiwei php-5.6.36]# cp -a /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[root@linbiwei php-5.6.36]# ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf
[root@linbiwei php-5.6.36]# sed -i '25s/;//g' /usr/local/php/etc/php-fpm.conf
[root@linbiwei php-5.6.36]# sed -i '303s/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,esca peshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,p osix_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,pos ix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkf ifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posi x_times,posix_ttyname,posix_uname/g' /usr/local/php/etc/php.ini
[root@linbiwei php-5.6.36]# sed -i '936s/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini
[root@linbiwei php-5.6.36]# sed -i '151s/; short_open_tag/short_open_tag = ON/g' /usr/local/php/etc/php.ini
[root@linbiwei php-5.6.36]# sed -i '1905s/;opcache.enable=0/opcache.enable=1/g' /usr/local/php/etc/php.ini
[root@linbiwei php-5.6.36]# sed -i '1908s/;opcache.enable_cli=0/opcache.enable_cli=0/g' /usr/local/php/etc/php.ini
[root@linbiwei php-5.6.36]# sed -i '$a zend_extension=opcache.so' /usr/local/php/etc/php.ini
root@linbiwei php-5.6.36]# sed -i '509s/;env[PATH] = /usr/local/bin:/usr/bin:/bin/env[PATH] = /usr/local/bin:/usr/bin:/bin/:/usr/local/php/bin/g' /usr/local/php/etc/php-fpm.conf
[root@linbiwei php-5.6.36]# cd /etc/init.d
[root@linbiwei init.d]# vi php-fpm 创建启动脚本
开始
#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-fpm
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
 
prefix=/usr/local/php
exec_prefix=${prefix}
 
php_fpm_BIN=${exec_prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid
 
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"
 
wait_for_pid () {
        try=0
 
        while test $try -lt 35 ; do
 
                case "$1" in
                        'created')
                        if [ -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
 
                        'removed')
                        if [ ! -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                esac
 
                echo -n .
                try=`expr $try + 1`
                sleep 1
 
        done
 
}
 
case "$1" in
        start)
                echo -n "Starting php-fpm "
 
                $php_fpm_BIN --daemonize $php_opts
 
                if [ "$?" != 0 ] ; then
                        echo " failed"
                        exit 1
                fi
 
                wait_for_pid created $php_fpm_PID
 
                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;
 
        stop)
                echo -n "Gracefully shutting down php-fpm "
 
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
 
                kill -QUIT `cat $php_fpm_PID`
 
                wait_for_pid removed $php_fpm_PID
 
                if [ -n "$try" ] ; then
                        echo " failed. Use force-quit"
                        exit 1
                else
                        echo " done"
                fi
        ;;
 
        force-quit)
                echo -n "Terminating php-fpm "
 
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
 
                kill -TERM `cat $php_fpm_PID`
 
                wait_for_pid removed $php_fpm_PID
 
                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;
 
        restart)
                $0 stop
                $0 start
        ;;
 
        reload)
 
                echo -n "Reload service php-fpm "
 
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
 
                kill -USR2 `cat $php_fpm_PID`
 
                echo " done"
        ;;
 
        *)
                echo "Usage: $0 {start|stop|force-quit|restart|reload}"
                exit 1
        ;;
 
esac
结束
[root@linbiwei init.d]# chmod 755 php-fpm
[root@linbiwei init.d]# chkconfig php-fpm on
[root@linbiwei init.d]# service php-fpm restart
[root@linbiwei init.d]# vi /etc/profile 
添加环境变量,方便直接在任何目录下使用php -v,php -m, php -i等操作
PATH=/usr/local/php/bin:/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
[root@linbiwei init.d]# source /etc/profile  设置生效

windows共享目录到centos

[root@linbiwei software]# yum install perl
点击Vmware菜单栏虚拟机—>安装Vmware tools
[root@linbiwei software]# mkdir /mnt/cdrom  创建目录
[root@linbiwei software]# mount /dev/cdrom /mnt/cdrom 挂载
[root@linbiwei software]# cd /mnt/cdrom 进入挂载目录
[root@linbiwei cdrom]# ll 查看VMware tools安装包
总用量 71994
-r-xr-xr-x 1 root root     1994 11月 11 2015 manifest.txt
-r-xr-xr-x 1 root root     1850 11月 11 2015 run_upgrader.sh
-r--r--r-- 1 root root 72270857 11月 11 2015 VMwareTools-10.0.5-3228253.tar.gz
-r-xr-xr-x 1 root root   687524 11月 11 2015 vmware-tools-upgrader-32
-r-xr-xr-x 1 root root   757944 11月 11 2015 vmware-tools-upgrader-64
[root@linbiwei cdrom]# mkdir /usr/local/vm-src 创建安装包存放文件夹
[root@linbiwei cdrom]# cp VMwareTools-10.0.5-3228253.tar.gz /usr/local/vm-src  把挂载目录中的安装包拷贝到存放文件夹中
[root@linbiwei cdrom]# cd /usr/local/vm-src 进入存放文件夹中
[root@linbiwei vm-src]# umount /dev/cdrom  卸载
[root@linbiwei vm-src]# tar zxvf VMwareTools-10.0.5-3228253.tar.gz  解压
[root@linbiwei vm-src]# ll
总用量 70584
-r--r--r-- 1 root root 72270857 6月  28 08:38 VMwareTools-10.0.5-3228253.tar.gz
drwxr-xr-x 9 root root     4096 11月 11 2015 vmware-tools-distrib
[root@linbiwei vm-src]# cd vmware-tools-distrib
[root@linbiwei vmware-tools-distrib]# ./vmware-install.pl 执行文件
接下来一路回车即可
最后会看到这些
Creating a new initrd boot image for the kernel.
Generating the key and certificate files.
Successfully generated the key and certificate files.
vmware-tools-thinprint start/running
initctl: Job failed to start
Unable to start services for VMware Tools

Execution aborted.
需要解决initctl: Job failed to start
[root@linbiwei vm-src]# ll /etc/init/vmware-tools-thinprint.conf
-rw-r--r-- 1 root root 351 6月  28 08:41 /etc/init/vmware-tools-thinprint.conf
[root@linbiwei vm-src]# rm /etc/init/vmware-tools-thinprint.conf
rm: 是否删除普通文件 "/etc/init/vmware-tools-thinprint.conf"?yes
[root@linbiwei vm-src]# /etc/vmware-tools/services.sh start 
   Checking acpi hot plug                                  [确定]
Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                       [确定]
   VM communication interface:                             [确定]
   VM communication interface socket family:               [确定]
   Guest filesystem driver:                                [确定]
   Mounting HGFS shares:                                   [失败]
   Blocking file system:                                   [失败]
   Guest operating system daemon:                          [确定]
   VGAuthService:                                          [确定]
   Common Agent:                                           [确定]
接下来解决Blocking file system:[失败]
Mounting HGFS shares:[失败]
[root@linbiwei vm-src]# yum install fuse-libs
[root@linbiwei vm-src]# mkdir /mnt/win
[root@linbiwei vm-src]# /usr/bin/vmhgfs-fuse .host:/ /mnt/win -o subtype=vmhgfs-fuse,allow_other
[root@linbiwei vm-src]# reboot 重启
接着到虚拟机菜单栏点击虚拟机—>设置—>左上角选项—>选共享文件夹—>点击右边总是启用—>添加共享目录
[root@linbiwei vm-src]# cd /mnt/hgfs  windows共享的文件夹一般都在hgfs目录
[root@linbiwei hgfs]# ll
总用量 4
drwxrwxrwx 1 root root 4096 5月  23 11:13 backend 这个文件夹是从windows共享出来的 
最后就可以完美的在linux开发环境下搞事了~~~
版权声明:本站文章采用知识共享署名4.0 国际许可协议进行许可,请在转载时注明出处及本声明!
名称不能为空
email
邮箱不能为空,请填写正确格式
link
网址请用http://或https://开头
message
评论不能为空
支持Markdown和LaTex数学公式
sentiment_very_satisfied

captcha
请输入验证码

    415 415
    415
    September 25th, 2019 at 10:12 pm415
    keyboard_arrow_down
    September 25th, 2019 at 10:12 pm

    牛B

    remove_red_eye
    访客
keyboard_arrow_up