重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
系统运维 Web服务器群集之LAMP平台部署(LAMP架构搭建)
涉及:Linux/Centos7系统 Apache mysql PHP
成都创新互联公司长期为近1000家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为敦煌企业提供专业的成都网站制作、网站设计、外贸网站建设,敦煌网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。一、前言 上一篇文章主要讲述了有关Web与HTTP协议的基础知识,有了这一基础知识理论的奠定,将对我们此次搭建部署LAMP平台的实验有所帮助。
LAMP架构是非常成熟的企业网站应用模式之一,其指的是协同工作的一整套系统和相关软件,能够提供动态Web站点服务及其应用开发环境。LAMP是一个缩写词——Linux操作系统、Apache网站服务器、Mysql数据库服务器、PHP(或Perl、Python)网页编程语言。
下面我们通过具体实际操作流程来讲述整个LAMP架构的搭建过程。
二、LAMP架构搭建实际流程(文章最后含详细步骤与相关解释) 一般来说首先安装好Linux操作系统,之前的文章中有关于安装Centos7的安装步骤,这里就不再过多赘述了。
其次是安装Apache、MYSQL以及PHP组件,最后使用论坛以测试该架构。下面具体阐述操作这些流程。
相关组件与压缩包资源:
链接:https://pan.baidu.com/s/1Q2hz5x85p_8JSnVe--Abtg
提取码:xfqf
资源组件如下:
[root@localhost LAMP-C7]# ls -lh
total 63M
-rw-r--r--. 1 root root 1.1M Dec 13 09:44 apr-1.6.2.tar.gz
-rw-r--r--. 1 root root 553K Dec 13 09:44 apr-util-1.6.0.tar.gz
-rw-r--r--. 1 root root 9.4M Dec 13 09:44 Discuz_X2.5_SC_UTF8.zip
-rw-r--r--. 1 root root 6.3M Dec 13 09:44 httpd-2.4.29.tar.bz2
-rw-r--r--. 1 root root 32M Dec 13 09:44 mysql-5.6.26.tar.gz
-rw-r--r--. 1 root root 14M Dec 13 09:44 php-5.6.11.tar.bz2
2.1Apache组件手工编译安装流程1.解压三个包
[root@localhost LAMP-C7]# tar zxf apr-1.6.2.tar.gz -C /opt/
[root@localhost LAMP-C7]# tar zxf apr-util-1.6.0.tar.gz -C /opt/
[root@localhost LAMP-C7]# tar jxf httpd-2.4.29.tar.bz2 -C /opt/
[root@localhost LAMP-C7]# cd /opt/
[root@localhost opt]# ls
apr-1.6.2 apr-util-1.6.0 httpd-2.4.29 rh
[root@localhost opt]# mv apr-1.6.2/ httpd-2.4.29/srclib/apr
[root@localhost opt]# mv apr-util-1.6.0/ httpd-2.4.29/srclib/apr-util
[root@localhost opt]# cd httpd-2.4.29/srclib/
[root@localhost srclib]# ls
apr apr-util Makefile.in
[root@localhost srclib]# cd ..
[root@localhost httpd-2.4.29]# ls
ABOUT_APACHE BuildBin.dsp emacs-style LAYOUT NOTICE srclib
acinclude.m4 buildconf httpd.dep libhttpd.dep NWGNUmakefile support
Apache-apr2.dsw CHANGES httpd.dsp libhttpd.dsp os test
Apache.dsw CMakeLists.txt httpd.mak libhttpd.mak README VERSIONING
apache_probes.d config.layout httpd.spec LICENSE README.cmake
ap.d configure include Makefile.in README.platforms
build configure.in INSTALL Makefile.win ROADMAP
BuildAll.dsp docs InstallBin.dsp modules server
2.安装所需环境包
[root@localhost httpd-2.4.29]# yum install -y gcc gcc-c++ make pcre-devel perl expat-devel
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 153 kB 00:00:00
(2/4): base/7/x86_64/group_gz | 165 kB 00:00:00
(3/4): base/7/x86_64/primary_db | 6.0 MB 00:00:12
(4/4): updates/7/x86_64/primary_db | 5.8 MB 00:00:48
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.ustc.edu.cn
* updates: ftp.sjtu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
......//省略部分内容
Install 4 Packages (+6 Dependent packages)
Upgrade 2 Packages (+6 Dependent packages)
Total download size: 67 M
Downloading packages:
3.参数配置
[root@localhost httpd-2.4.29]# ./configure \\
> --prefix=/usr/local/httpd \\
> --enable-so \\
> --enable-rewrite \\
> --enable-charset-lite \\
> --enable-cgi
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-pc-linux-gnu
......//省略部分内容
config.status: executing default commands
configure: summary of build options:
Server Version: 2.4.29
Install prefix: /usr/local/httpd
C compiler: gcc -std=gnu99
CFLAGS: -g -O2 -pthreadCPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCELDFLAGS: LIBS: C preprocessor: gcc -E
4.编译与安装(等待时间稍长,mysql耗时更久,请务必耐心)
[root@localhost httpd-2.4.29]# make && make install
Making all in srclib
make[1]: Entering directory `/opt/httpd-2.4.29/srclib\'
Making all in apr
make[2]: Entering directory `/opt/httpd-2.4.29/srclib/apr\'
make[3]: Entering directory `/opt/httpd-2.4.29/srclib/apr\'
/opt/httpd-2.4.29/srclib/apr/build/mkdir.sh tools
/bin/sh /opt/httpd-2.4.29/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread
.......//省略部分内容
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: Leaving directory `/opt/httpd-2.4.29\'
[root@localhost httpd-2.4.29]#
5.优化启动脚本路径与文件
[root@localhost ~]# cd
[root@localhost ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost ~]# vim /etc/init.d/httpd
[root@localhost ~]# head /etc/init.d/httpd
#!/bin/sh
# chkconfig: 35 85 21
# description: Apache is a World Wide Web server
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the License); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
[root@localhost ~]# chkconfig --add httpd
[root@localhost ~]#
6.主配置文件设置
[root@localhost ~]# vim /usr/local/httpd/conf/httpd.conf
[root@localhost ~]# head -197 /usr/local/httpd/conf/httpd.conf | tail -1
ServerName www.lokott.com:80
[root@localhost ~]# head -52 /usr/local/httpd/conf/httpd.conf | tail -2
Listen 192.168.68.132:80
#Listen 80
7.优化配置文件路径(创建软链接)
[root@localhost ~]# ln -s /usr/local/httpd/conf/httpd.conf /etc/
[root@localhost ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin/
8.关闭防火墙和SELinux功能
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
9.启动服务——service httpd start
10.测试验证服务是否开启成功
2.2MySQL组件手工编译安装流程1.解压缩软件包并且安装环境包
[root@localhost LAMP-C7]# tar zxf mysql-5.6.26.tar.gz -C /opt/
[root@localhost LAMP-C7]# cd /opt/mysql-5.6.26/
[root@localhost mysql-5.6.26]# ls -lh
total 668K
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 BUILD
-rw-r--r--. 1 7161 wheel 142 Jul 15 2015 BUILD-CMAKE
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 client
drwxr-xr-x. 4 7161 wheel 4.0K Jul 15 2015 cmake
-rw-r--r--. 1 7161 wheel 22K Jul 15 2015 CMakeLists.txt
drwxr-xr-x. 3 7161 wheel 21 Jul 15 2015 cmd-line-utils
-rw-r--r--. 1 7161 wheel 20K Jul 15 2015 config.h.cmake
-rw-r--r--. 1 7161 wheel 36K Jul 15 2015 configure.cmake
-rw-r--r--. 1 7161 wheel 18K Jul 15 2015 COPYING
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 dbug
drwxr-xr-x. 2 7161 wheel 102 Jul 15 2015 Docs
-rw-r--r--. 1 7161 wheel 65K Jul 15 2015 Doxyfile-perfschema
drwxr-xr-x. 3 7161 wheel 212 Jul 15 2015 extra
drwxr-xr-x. 4 7161 wheel 4.0K Jul 15 2015 include
-rw-r--r--. 1 7161 wheel 393K Jul 15 2015 INSTALL-SOURCE
-rw-r--r--. 1 7161 wheel 247 Jul 15 2015 INSTALL-WIN-SOURCE
drwxr-xr-x. 7 7161 wheel 4.0K Jul 15 2015 libevent
drwxr-xr-x. 3 7161 wheel 199 Jul 15 2015 libmysql
drwxr-xr-x. 3 7161 wheel 204 Jul 15 2015 libmysqld
drwxr-xr-x. 2 7161 wheel 221 Jul 15 2015 libservices
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 man
drwxr-xr-x. 10 7161 wheel 4.0K Jul 15 2015 mysql-test
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 mysys
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 mysys_ssl
drwxr-xr-x. 14 7161 wheel 207 Jul 15 2015 packaging
drwxr-xr-x. 9 7161 wheel 141 Jul 15 2015 plugin
-rw-r--r--. 1 7161 wheel 2.5K Jul 15 2015 README
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 regex
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 scripts
drwxr-xr-x. 4 7161 wheel 12K Jul 15 2015 sql
drwxr-xr-x. 5 7161 wheel 4.0K Jul 15 2015 sql-bench
drwxr-xr-x. 2 7161 wheel 125 Jul 15 2015 sql-common
drwxr-xr-x. 13 7161 wheel 169 Jul 15 2015 storage
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 strings
drwxr-xr-x. 5 7161 wheel 4.0K Jul 15 2015 support-files
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 tests
drwxr-xr-x. 5 7161 wheel 103 Jul 15 2015 unittest
-rw-r--r--. 1 7161 wheel 88 Jul 15 2015 VERSION
drwxr-xr-x. 3 7161 wheel 4.0K Jul 15 2015 vio
drwxr-xr-x. 2 7161 wheel 32 Jul 15 2015 win
drwxr-xr-x. 2 7161 wheel 4.0K Jul 15 2015 zlib
[root@localhost mysql-5.6.26]# yum install ncurses-devel cmake autoconf -y
......//省略部分内容
2.参数配置
[root@localhost mysql-5.6.26]# cmake \\
> -DCMKE_INSTALL_PREFIX=/usr/local/mysql \\
> -DDEFAULT_CHARSET=utf8 \\
> -DDEFAULT_COLLATION=utf8_general_ci \\
> -DEXTRA_CHARSETS=all \\
> -DSYSCONFIDIR=/etc \\
> -DMYSQL_DATADIR=/home/mysql \\
> -DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock
......//省略部分内容
-- Build files have been written to: /opt/mysql-5.6.26
[root@localhost mysql-5.6.26]#
3.编译与安装(时间较长,请耐心等待)
[root@localhost mysql-5.6.26]# make && make install
......//省略部分内容
-- Installing: /usr/local/mysql/sql-bench/innotest1a
-- Installing: /usr/local/mysql/sql-bench/run-all-tests
-- Installing: /usr/local/mysql/sql-bench/innotest2
-- Installing: /usr/local/mysql/sql-bench/test-wisconsin
-- Installing: /usr/local/mysql/sql-bench/compare-results
-- Installing: /usr/local/mysql/sql-bench/bench-init.pl
[root@localhost mysql-5.6.26]#
4.优化处理
[root@localhost mysql-5.6.26]# ls
BUILD COPYING INSTALL-SOURCE mysys_ssl strings
BUILD-CMAKE CPackConfig.cmake INSTALL-WIN-SOURCE packaging support-files
client CPackSourceConfig.cmake libevent plugin tests
cmake CTestTestfile.cmake libmysql README unittest
CMakeCache.txt dbug libmysqld regex VERSION
CMakeFiles Docs libservices scripts VERSION.dep
cmake_install.cmake Doxyfile-perfschema make_dist.cmake source_downloads vio
CMakeLists.txt extra Makefile sql win
cmd-line-utils include man sql-bench zlib
config.h.cmake info_macros.cmake mysql-test sql-common
configure.cmake install_manifest.txt mysys storage
[root@localhost mysql-5.6.26]# \\cp support-files/my-default.cnf /etc/my.cnf
[root@localhost mysql-5.6.26]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.6.26]# chmod 755 /etc/init.d/mysqld
[root@localhost mysql-5.6.26]# chkconfig --add /etc/init.d/mysqld
[root@localhost mysql-5.6.26]# chkconfig mysqld --level 235 on
5.优化命令环境变量
[root@localhost mysql-5.6.26]# echo PATH=$PATH:/usr/local/mysql/bin/ >> /etc/profile
[root@localhost mysql-5.6.26]# source /etc/profile
[root@localhost mysql-5.6.26]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin/
6.添加程序用户
[root@localhost mysql-5.6.26]# useradd -s /sbin/nologin mysql
[root@localhost mysql-5.6.26]# chown -R mysql.mysql /usr/local/mysql/
7.初始化数据库
[root@localhost mysql-5.6.26]# /usr/local/mysql/scripts/mysql_install_db \\
> --user=mysql \\
> --ldata=/var/lib/mysql \\
> --basedir=/usr/local/mysql \\
> --datadir=/home/mysql
.......//省略部分内容
[root@localhost mysql-5.6.26]#
8.更改启动脚本并启动服务
[root@localhost mysql-5.6.26]# ln -s /var/lib/mysql/mysql.sock /home/mysql/mysql.sock
[root@localhost mysql-5.6.26]# vim /etc/init.d/mysqld
[root@localhost mysql-5.6.26]# head -47 /etc/init.d/mysqld |tail -2
basedir=/usr/local/mysql
datadir=/home/mysql
[root@localhost mysql-5.6.26]# service mysqld start
Starting MySQL. SUCCESS!
[root@localhost mysql-5.6.26]# netstat -natp | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 80619/mysqld
9.设置管理员密码
[root@localhost mysql-5.6.26]# mysqladmin -u root -p password 123456
Enter password:
Warning: Using a password on the command line interface can be insecure.
10.进入数据库验证查看
[root@localhost mysql-5.6.26]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 2
Server version: 5.6.26 Source distribution
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> exit
Bye
[root@localhost mysql-5.6.26]#
2.3PHP组件手工编译安装流程1.解压缩软件包并且安装所需环境
[root@localhost LAMP-C7]# tar jxf php-5.6.11.tar.bz2 -C /opt/
[root@localhost LAMP-C7]# yum install -y gd libpng libpng-devel libjpeg-devel pcre libxml2-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.ustc.edu.cn
* updates: ftp.sjtu.edu.cn
Package gd-2.0.35-26.el7.x86_64 already installed and latest version
Package 2:libpng-1.5.13-7.el7_2.x86_64 already installed and latest version
Package pcre-8.32-17.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 will be installed
.......//省略部分内容
2.参数配置设置
[root@localhost LAMP-C7]# cd /opt/php-5.6.11/
[root@localhost php-5.6.11]# ls
acinclude.m4 install-sh README.EXT_SKEL sapi
aclocal.m4 LICENSE README.GIT-RULES scripts
build ltmain.sh README.input_filter server-tests-config.php
buildconf main README.MAILINGLIST_RULES server-tests.php
buildconf.bat makedist README.md snapshot
CODING_STANDARDS Makefile.frag README.namespaces stamp-h.in
config.guess Makefile.gcov README.NEW-OUTPUT-API stub.c
config.sub Makefile.global README.PARAMETER_PARSING_API tests
configure makerpm README.RedisT.BINS travis
configure.in missing README.RELEASE_PROCESS TSRM
CREDITS mkinstalldirs README.SELF-CONTAINED-EXTENSIONS UPGRADING
ext netware README.STREAMS UPGRADING.INTERNALS
EXTENSIONS NEWS README.SUBMITTING_PATCH vcsclean
footer pear README.TESTING win32
generated_lists php5.spec.in README.TESTING2 Zend
genfiles php.gif README.UNIX-BUILD-SYSTEM
header php.ini-development README.WIN32-BUILD-SYSTEM
INSTALL php.ini-production run-tests.php
3.编译与安装
[root@localhost php-5.6.11]# ./configure \\
> --prefix=/usr/local/php5 \\
> --with-gd \\
> --with-zlib \\
> --with-apxs2=/usr/local/httpd/bin/apxs \\
> --with-mysql=/usr/local/mysql \\
> --with-config-file-path=/usr/local/mysql \\
> --enable-mbstring
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-unknown-linux-gnu
.....//省略部分内容
4.优化文件与更改主配置文件(PHP作为后端没有启动脚本,主要设置的是配置文件)
[root@localhost php-5.6.11]# make && make install
.......//省略部分内容
/opt/php-5.6.11/build/shtool install -c ext/phar/phar.phar /usr/local/php5/bin
ln -s -f phar.phar /usr/local/php5/bin/phar
Installing PDO headers: /usr/local/php5/include/php/ext/pdo/
[root@localhost php-5.6.11]#
5.将配置文件存放到指定的目录下并且优化命令(创建软链接)
[root@localhost php-5.6.11]# ls
acinclude.m4 INSTALL NEWS README.TESTING2
aclocal.m4 install-sh pear README.UNIX-BUILD-SYSTEM
build libphp5.la php5.spec README.WIN32-BUILD-SYSTEM
buildconf libs php5.spec.in run-tests.php
buildconf.bat libtool php.gif sapi
CODING_STANDARDS LICENSE php.ini-development scripts
config.guess ltmain.sh php.ini-production server-tests-config.php
config.log main README.EXT_SKEL server-tests.php
config.nice makedist README.GIT-RULES snapshot
config.status Makefile README.input_filter stamp-h.in
config.sub Makefile.frag README.MAILINGLIST_RULES stub.c
configure Makefile.fragments README.md tests
configure.in Makefile.gcov README.namespaces travis
CREDITS Makefile.global README.NEW-OUTPUT-API TSRM
ext Makefile.objects README.PARAMETER_PARSING_API UPGRADING
EXTENSIONS makerpm README.REDIST.BINS UPGRADING.INTERNALS
footer meta_ccld README.RELEASE_PROCESS vcsclean
generated_lists missing README.SELF-CONTAINED-EXTENSIONS win32
genfiles mkinstalldirs README.STREAMS Zend
header modules README.SUBMITTING_PATCH
include netware README.TESTING
[root@localhost php-5.6.11]# cp php.ini-development /usr/local/php5/php.ini
[root@localhost php-5.6.11]# ln -s /usr/local/php5/bin/* /usr/local/bin/
6.配置主配置文件
[root@localhost php-5.6.11]# vim /etc/httpd.conf
[root@localhost php-5.6.11]# head -256 /etc/httpd.conf |tail -1
DirectoryIndex index.html index.php
[root@localhost php-5.6.11]# head -395 /etc/httpd.conf |tail -4
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps
[root@localhost php-5.6.11]#
7.设置php文件并重启httpd服务
[root@localhost php-5.6.11]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# cp index.html index.php
[root@localhost htdocs]# vim index.php
[root@localhost htdocs]# cat index.php
[root@localhost htdocs]# service httpd stop
[root@localhost htdocs]# service httpd start
8.本地测试验证
2.4论坛搭建测试该架构[root@localhost LAMP-C7]# ls
apr-1.6.2.tar.gz Discuz_X2.5_SC_UTF8.zip mysql-5.6.26.tar.gz
apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2 php-5.6.11.tar.bz2
[root@localhost LAMP-C7]#
[root@localhost LAMP-C7]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 3
Server version: 5.6.26 Source distribution
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
mysql> create database lokott;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| lokott |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> grant all on lokott.* to \'myuser\'@\'%\' identified by \'admin123\';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@localhost LAMP-C7]#
[root@localhost LAMP-C7]# unzip Discuz_X2.5_SC_UTF8.zip -d /opt/
....../省略部分内容
[root@localhost proc]# cd /opt/
[root@localhost opt]# ls
httpd-2.4.29 mysql-5.6.26 php-5.6.11 readme rh upload utility
[root@localhost opt]# cd upload/
[root@localhost upload]# cd ..
[root@localhost opt]# ls
httpd-2.4.29 mysql-5.6.26 php-5.6.11 readme rh upload utility
[root@localhost opt]# cp -r upload/ /usr/local/httpd/htdocs/lokott
[root@localhost opt]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# ls
index.html index.php lokott
[root@localhost htdocs]# cd lokott/
[root@localhost lokott]# ls
admin.php config data home.php misc.php search.php uc_client
api connect.php favicon.ico index.php plugin.php source uc_server
api.php cp.php forum.php install portal.php static userapp.php
archiver crossdomain.xml group.php member.php robots.txt template
[root@localhost lokott]#
此时发现状态都是不可写或者说目录不存在的,这是因为对应的文件目录的属主是root
[root@localhost lokott]# ls -l
total 76
-rw-r--r--. 1 root root 2603 Dec 13 12:20 admin.php
drwxr-xr-x. 11 root root 163 Dec 13 12:20 api
-rw-r--r--. 1 root root 727 Dec 13 12:20 api.php
drwxr-xr-x. 2 root root 23 Dec 13 12:20 archiver
drwxr-xr-x. 2 root root 90 Dec 13 12:20 config
-rw-r--r--. 1 root root 922 Dec 13 12:20 connect.php
-rw-r--r--. 1 root root 253 Dec 13 12:20 cp.php
-rw-r--r--. 1 root root 106 Dec 13 12:20 crossdomain.xml
drwxr-xr-x. 13 root root 216 Dec 13 12:20 data
-rw-r--r--. 1 root root 5558 Dec 13 12:20 favicon.ico
-rw-r--r--. 1 root root 2110 Dec 13 12:20 forum.php
-rw-r--r--. 1 root root 823 Dec 13 12:20 group.php
-rw-r--r--. 1 root root 1223 Dec 13 12:20 home.php
-rw-r--r--. 1 root root 5448 Dec 13 12:20 index.php
drwxr-xr-x. 5 root root 64 Dec 13 12:20 install
-rw-r--r--. 1 root root 1040 Dec 13 12:20 member.php
-rw-r--r--. 1 root root 1381 Dec 13 12:20 misc.php
-rw-r--r--. 1 root root 1757 Dec 13 12:20 plugin.php
-rw-r--r--. 1 root root 985 Dec 13 12:20 portal.php
-rw-r--r--. 1 root root 582 Dec 13 12:20 robots.txt
-rw-r--r--. 1 root root 1158 Dec 13 12:20 search.php
drwxr-xr-x. 10 root root 168 Dec 13 12:20 source
drwxr-xr-x. 6 root root 72 Dec 13 12:20 static
drwxr-xr-x. 3 root root 38 Dec 13 12:20 template
drwxr-xr-x. 6 root root 92 Dec 13 12:20 uc_client
drwxr-xr-x. 13 root root 241 Dec 13 12:20 uc_server
-rw-r--r--. 1 root root 1691 Dec 13 12:20 userapp.php
[root@localhost lokott]# chown -R daemon config/
[root@localhost lokott]# chown -R daemon data/
[root@localhost lokott]# chown -R daemon uc_client/
[root@localhost lokott]# chown -R daemon uc_server/