设为首页 收藏本站
查看: 839|回复: 0

CentOS 6.5使用yum快速搭建LAMP环境

[复制链接]

尚未签到

发表于 2015-8-19 12:02:16 | 显示全部楼层 |阅读模式
  由于这里采用yum方式安装,前提是我们必须配置好yum源。为了加快下载速度,建议使用网易的yum源。参考:CentOS配置网易163yum源 http://www.iyunv.com/Linux/2014-07/104562.htm
  这种方式对于初学者来说,非常方便,但是可定制性不强,而且软件版本较低。一般用于实验和学习环境。
  CentOS 6.5安装配置LAMP http://www.iyunv.com/Linux/2014-07/104373.htm
  Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置 http://www.iyunv.com/Linux/2013-06/86250.htm
  CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12) http://www.iyunv.com/Linux/2013-03/80333p3.htm
  RedHat 5.4下Web服务器架构之源码构建LAMP环境及应用PHPWind http://www.iyunv.com/Linux/2012-10/72484p2.htm
  LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP http://www.iyunv.com/Linux/2013-05/84882.htm
  基于Ubuntu 的LAMP 优化加固 http://www.iyunv.com/Linux/2014-07/104092.htm
  1、安装Apache
  [iyunv@localhost ~]# yum -y install httpd
  # 开机自启动
  [iyunv@localhost ~]# chkconfig httpd on
  # 启动httpd 服务
  [iyunv@localhost ~]# service httpd start
  ### 安装apache 一些扩展
  root@localhost ~]# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
  
现在直接在浏览器键入http://localhost  或 http://本机IP  ,应该会看到Apache的测试页面
  这里需要注意iptables的设置哦。
DSC0000.jpg
  2、安装配置MySQL
  # mysql          客户端程序
  # mysql-server    服务端程序
  # mysql-devel    开发设计的库
  [iyunv@localhost ~]# yum -y install mysql mysql-server mysql-devel
  
  # 开机启动
  [iyunv@localhost ~]# chkconfig mysqld on
  # 启动mysqld服务
  [iyunv@localhost ~]# service mysqld start
  # 进行一些安全性配置
  [iyunv@localhost ~]# /usr/bin/mysql_secure_installation
  
  [iyunv@localhost ~]# netstat -tulpn | grep -i mysql
  tcp        0      0 0.0.0.0:3306          0.0.0.0:*          LISTEN      1723/mysqld
  
OK, 我们看到mysqld已经启动,监听在3306端口上。
  3、安装php
  
安装相关模块:为了让PHP支持MySQL,我们可以安装php-mysql软件包;也可使用以下命令搜索可用的php模块
  [iyunv@localhost ~]# yum -y install php php-mysql
  # 安装php常用扩展
  [iyunv@localhost ~]# yum search php
  [iyunv@localhost ~]# yum -y install gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
  ### 重启httpd服务,这一步很重要
  [iyunv@localhost ~]# service httpd restart
  
然后,我们提供php页面,测试
  [iyunv@localhost ~]# cd /var/www/html/
  [iyunv@localhost html]# vi index.php
  <?php
  phpinfo();
  ?>
  
然后,我们再次在浏览器键入http://localhost  或 http://本机IP  ,应该会看到如下页面
DSC0001.jpg
  4、安装配置phpMyAdmin
  安装好MySQL,Apache及PHP后,为了可视化的管理MySQL数据库,我们可以安装phpMyAdmin。到其官网下载最新版本:http://www.phpmyadmin.net/home_page/
  在Windows下,其实Navicat也是一个非常好用的MySQL可视化工具,推荐使用。
  [iyunv@localhost ~]# unzip phpMyAdmin-4.2.6-all-languages.zip
  [iyunv@localhost ~]# mv phpMyAdmin-4.2.6-all-languages /var/www/html/phpmyadmin
  [iyunv@localhost ~]# cd /var/www/html/phpmyadmin
  [iyunv@localhost ~]# cp libraries/config.default.php config.inc.php
  
  [iyunv@localhost ~]# vi cnfig.inc.php
  $cfg['PmaAbsoluteUri'] = '';这里填写 phpMyAdmin 的访问网址。
  $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
  $cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
  $cfg['Servers'][$i]['user'] = 'root'; // 填写 MySQL 访问 phpMyAdmin 使用的 MySQL 用户名,默认为 root。
  fg['Servers'][$i]['password'] = ''; // 填写对应上述 MySQL 用户名的密码。
  
  
  # 然后重启,httpd服务
  [iyunv@localhost ~]# service httpd restart
  
在浏览器键入http://localhost/phpmyadmin 即可访问。
  如果遇到访问权限的问题, 请检查SElinux。
  
  1130mysql连接错误解决方法:
  mysql -u root -p;
  mysql>use mysql;
  mysql>update user set host = '%' where user = 'root';
  mysql>FLUSH PRIVILEGES;
  mysql>select host, user from user;
  
  完全卸载mysql方法:
  yum remove mysql mysql-server mysql-libs compat-mysql51
rm -rf /var/lib/mysql
rm /etc/my.cnf
查看是否还有mysql软件:
rpm -qa|grep mysql
如果存在的话,继续删除即可。
  
  vsftpd:


centos 安装vsftpd  
2011-08-25 09:21:45|  分类: centos|举报|字号 订阅




  1.查看有没有安装vsftpd:
rpm -qa | grep vsftpd
2.yum安装vsftpd:
yum install vsftpd
3.rpm安装vsftpd:
    可以从下面两个地方获得最新的vsftpd的RPM包https://www.redhat.com/或者http://www.rpmfind.net/


安装命令:

rpm -Uvh vsftpd-1.1.3-8.i386.rpm

4.设置每次开机时自动运行及手工启动它:
chkconfig vsftpd on
service vsftpd start
netstat -tl 可以查看ftp端口是否在侦听了!

5.为vsftpd添加ftp账号
用useradd建立的用户,如果后面不加参数,建立的用户为普通用户,有系统登陆权限,所以要在useradd命令后面加上参数,为虚拟主机添加不可以登录系统的ftp专用账号,命令如下:
# useradd –s /sbin/nologin –d /var/www   -g ftp ftpadmin

  如果显示如下信息:
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
表示用户家目录已经存在(/var/www),不可再新建此目录,并非添加用户失败,接下来给用户设置密码,否则此账号不能使用,命令如下:
# passwd ftpadmin
这样就为linux系统添加用户ftpadmin,用户目录指定为/var/www,属于ftp用户组,且此用户不能登陆系统。
注:
-s /sbin/nologin是让其不能登陆系统
-d 是指定用户目录为/var/www
-g ftp 把用户加入到ftp组中
修改/var/www目录属性:
$ chmod -R 777 /var/www 递归地给此目录下所有文件和子目录的读、写、执行权限
$ chgrp -R ftp   /var/www 递归地把此目录及该目录下所有文件和子目录的组属性设置成ftp组
6.配置etc/vsftpd/vsftpd.conf文件:
nano -w /etc/vsftpd/vsftpd.conf
注:用nano编辑配置文件要加参数“-w”,用于取消自动换行,否则有可能会出错。

配置文件范例:

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd whith two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

pam_service_name=vsftpd
chroot_local_user=YES
userlist_enable=YES
tcp_wrappers=YES

  注:此配置文件仅在默认配置文件基础上修改为如下两项:
anonymous_enable=NO #禁止匿名登录

chroot_local_user=YES     #把系统内所有的FTP用户都限制在家目录中
7.查看谁登陆了FTP,并杀死它的进程
ps –xf |grep ftp
kill 进程号
8.使vsftp下root登录:
1)编辑两个FTP配置文件:/etc/vsftpd.ftpusers和/etc/vsftpd.user_list,将root那一行删掉或#注释掉;
2)重启vsftpd服务:

service vsftpd restart

  设置虚拟目录
  # cd /var/ftp
  # mkdir v1
  # mount --bind /sourcedir /var/ftp/v1
  # vi /etc/fstab
  在最后增加一行:
  /sourcedir /var/ftp/v1 none ro,bind 0 0 # /etc/init.d/vsftpd restart
  
  dedecms修改:
  1.channelartlist标签在5.7中只有row属性,如果是需要频道页面样式比较独特的网站不能够满足循环调用的需求,所以,给它加上limit属性就好了。
  给这个标签加limit属性也非常容易,dedecms的程序优点就在于扩展。
  打开include/taglib/channelartlist.lib.php文件,约62行处,在下面加一行
  if(empty($totalnum)) $totalnum = 20;
  
if(!empty($limit)) $totalnum =$limit;
  这样,如果有limit属性的话就用limit属性来控制调用的记录数量了。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-101111-1-1.html 上篇帖子: Linux系统搭建LAMP平台 下篇帖子: 【RMQ】A Magic Lamp
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表