centos 6.5下20分钟搭建运行环境 apache+php5.4+mysql + zend

2017-02-15 21:29:15
修改主机名:[root@iZ25cw99yk8Z ~]#vi /etc/sysconfig/networkHOSTNAME=youwebsite.com修改/etc/hosts文件vi /etc/hosts添加一行:127....
修改主机名:
[root@iZ25cw99yk8Z ~]#
vi /etc/sysconfig/network
HOSTNAME=youwebsite.com

修改/etc/hosts文件
vi /etc/hosts
添加一行:
127.0.0.1 xadiannao.com www.xadiannao.com

修改之后,不会立刻看到。等后面的配置都搞完了,再一起重启下。

云硬盘(数据盘)的挂载:
默认即使购买了数据盘,linux主机也是没有挂载状态的。
[root@iZ25cw99yk8Z ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  1.8G   17G  10% /
tmpfs           938M     0  938M   0% /dev/shm


查看硬盘状态:

[root@iZ25cw99yk8Z ~]# fdisk -l

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078f9c

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1        2611    20970496   83  Linux

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

有107.4GB的硬盘等着挂载。

fdisk /dev/xvdb

fdisk /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3882fa47.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3882fa47

    Device Boot      Start         End      Blocks   Id  System

Command (m for help):
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1): 直接回车
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054): 直接回车
Using default value 13054

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

yum install e4fsprogs     #安装ext4 的用户态工具


[root@iZ25cw99yk8Z ~]# mkfs.ext4 -E lazy_itable_init=1 /dev/xvdb
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统inux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

正在写入inode表: 完成                           
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

创建目录,准备挂载:
mkdir /workspace

mount /dev/xvdb /workspace

[root@iZ25cw99yk8Z /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  1.9G   17G  10% /
tmpfs           938M     0  938M   0% /dev/shm
/dev/xvdb        99G  188M   94G   1% /workspace

写入开机执行:
echo "/dev/xvdb  /workspace ext4 defaults,noatime,nodiratime 0 0 " >> /etc/fstab


yum install update
wget -q -O - http://www.atomicorp.com/installers/atomic | sh

//非腾讯云主机,执行下面的操作。
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
rm  /etc/yum.repos.d/CentOS-Ku6.repo -rf
yum makecache
//——

yum install update

传输工具安装:
yum install lrzsz

安装apache,php

yum install -y httpd php php-common php-devel php-gd php-mcrypt php-mbstring php-pear php-bcmath php-mhash php-mysql php-xml gcc



如果提示错误:GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
删除:rm /etc/yum.repos.d/epel.repo -rf


service httpd start

[root@iZ25cw99yk8Z ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 10.170.114.113 for ServerName
[  OK  ]
提示信息不用担心。只要看到:[  OK  ] 说明已经正常可以访问了。

通过外网ip先访问下:不能通过内网IP访问。




加入到自启动项:

chkconfig httpd on



如果需要通过命令行操作mysql
yum install mysql-devel




配置:httpd.conf
mkdir /workspace/wwwroot/wuzhicms.com/www -p
mkdir /workspace/logs/ -p

vi /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
    ServerAdmin root@wuzhicms.com
    DocumentRoot /workspace/wwwroot/wuzhicms.com/www
    ServerName wuzhicms.com
    <Directory  /data/wwwroot/wuzhicms.com/www>
        Options  FollowSymLinks
        AllowOverride Options FileInfo
        Order allow,deny
        Allow from all
        php_admin_value open_basedir /workspace/wwwroot/wuzhicms.com/:/tmp/
        DirectoryIndex index.html index.php index.htm
    </Directory>
    ErrorLog "| /usr/sbin/rotatelogs /workspace/logs/%m_%d_wuzhicms.com-error_log 86400 480"
    CustomLog "| /usr/sbin/rotatelogs /workspace/logs/%m_%d_wuzhicms.com-access_log 86400 480" common
</VirtualHost>

/tmp/ 为 php 上传文件的临时目录,如果要修改 php.ini 中的 upload_tmp_dir = /tmp/  需要保持一致。否则无法上传文件。

apache  配置虚拟主机后,出现禁止访问的情况。

查看是否开启了 SELinux

检查SElinux是否在用
# getenforce



Mysql 数据库安装:

yum install -y mysql-server gcc

mkdir /workspace/mysqldata -p

vi /etc/my.cnf

清空里面的内容

黏贴:

# This is for a large system with memory of 1G-2G where the system runs mainly
[client]
#password       = your_password
port            = 3306
socket          = /var/lib/mysql/mysql.sock
# The MySQL server
[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
#skip-grant-tables

#Path to the database root
datadir=/workspace/mysqldata

skip-external-locking
key_buffer_size = 128M
max_allowed_packet = 8M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 32M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 2

max_connections = 200

#skip-networking
# Master config ------------------------------
log-bin                         = mysql-bin
server-id                       = 1
innodb_flush_log_at_trx_commit  = 1
sync_binlog                     = 1
# Master config END --------------------------

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


启动mysql
service mysqld start


[root@iZ25cw99yk8Z ~]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
141219 23:10:26 [Note] libgovernor.so not found
141219 23:10:26 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
OK
Filling help tables...
141219 23:10:26 [Note] libgovernor.so not found
141219 23:10:26 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]


设置初始密码

/usr/bin/mysqladmin -u root password ‘XM32320sjuwhJSi.D’

mysql服务开机启动

chkconfig --add mysqld
chkconfig mysqld on


重启服务器。
reboot

1/检查主机名是否生效;
2/硬盘挂载是否正确

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       20G  1.7G   17G   9% /
tmpfs           938M     0  938M   0% /dev/shm
/dev/xvdb        99G   90M   94G   1% /workspace

3/数据库是否正常启动,是否为正确的datadir 路径。/workspace/mysqldata

ps -ef|grep mysql

root       935     1  0 23:18 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/workspace/mysqldata --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql     1303   935  0 23:18 ?        00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/workspace/mysqldata --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/workspace/mysqldata/afishinglife.com.err --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock --port=3306
4/访问网站是否正常。

ok。

从附件中,找到对应的zend guard loader 。64位或者 32位。
Zend guard loader 安装:
zend guard loader - php 5.4 64位 ,快速安装:
cd  /usr/lib64/php/modules/
wget http://cdn.wuzhicms.com/soft/zen ... /ZendGuardLoader.so
其他的下载对应的附件。

修改/etc/php.ini
增加:

zend_loader.enable=1
zend_loader.disable_licensing=1
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_extension="/usr/lib64/php/modules/ZendGuardLoader.so"

 

改为你的路径:/usr/lib64/php/modules/ZendGuardLoader.so

完成后:
[root@VM_204_220_centos modules]# php -v
PHP 5.4.36 (cli) (built: Dec 22 2014 16:06:29)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

重启 httpd
service httpd restart

相关词搜索:环境

上一篇:总结CentOS-6.3安装配置SVN
下一篇:最后一页