zoukankan      html  css  js  c++  java
  • centos5.5服务器基本篇

    一.centos5.5服务器基本
    1.使用su -切换到root目录下
    2.查看硬盘空间大小:df -lh
    3.安装软件(yum): yum install softname
    4.tar安装: 
    a.下载软件到当前目录:wget http://www.domain.com/soft.tar.gz
    b.tar -zxvf soft.tar.gz
    c.cd soft
    d../configure
    e.make
    f.make install
    注意:如果gcc没有安装,使用yum install gcc安装,如果make没有安装,使用yum install make安装
    5.开启常见iptables端口:
    /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
    保存:/etc/rc.d/init.d/iptables save
    重启:service iptables restart
    查看:/etc/rc.d/init.d/iptables status
    6.一些软件安装后,默认不会随系统启动而启动,如果要随系统启动而启动使用如下命令:
    chkconfig service(如httpd) on
    使用命令查看:chkconfig --list service,确保2-5处于on
    mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

    二.mysql安装

    更改源便于安装php5.2:

    # rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

    # vi /etc/yum.repos.d/CentOS-Base.repo 增加下面信息

    [utterramblings]
    name=Jason's Utter Ramblings Repo
    baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
    enabled=1
    gpgcheck=1
    gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka


    1.yum install mysql mysql-server
    2.chkconfig mysqld on
    3.service mysqld start
    4.更改root密码,mysqladmin -u root password 新密码[此项重要,并且要确保所有的root密码都要被更改]

    三.apache安装
    1.yum install httpd
    2.chkconfig httpd on
    3.service httpd restart
    4.apache默认主要配置文件为:/etc/httpd/conf目录下

    虚拟主机错误:linux CentOs 权限导致的Apache - "DocumentRoot must be a directory"的解决方案  
    解决方法:

    把目录或文件的策略类型改成 httpd_sys_content_t 就可以了

    chcon -R -h -t httpd_sys_content_t /www

    四.php安装:
    1.最小安装:yum install php
    2.安装php常用扩展:
    yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring
    3.重启apache

    五.安装iftop
    1、安装必须软件包
    yum install libpcap libpcap-devel ncurses ncurses-devel

    2、安装iftop
    cd /tmp
    wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
    tar -zxvf iftop-0.17.tar.gz
    cd iftop-0.17
    ./configure
    make
    make install

    六.安装vsftpd
    1.yum -y install vsftpd
    2.编辑 /etc/vsftpd/vsftpd.conf,以下设置在centos为默认设置
    local_enable = Yes #允许本地用户
    write_enable = Yes #允许写入
    local_umask = 022 #默认掩码
    chroot_local_user = Yes #将用户限制在目录下,不能更改目录
    3.增加用户
    useradd -g ftp -d /home/www -s /sbin/nologin www
    4.修改目录权限
    5.更改目录为www用户所有
    chown www:ftp /home/www

    6.配置pasv传输

    vsftpd.conf加入

    pasv_max_port=41000
    pasv_min_port=42000

    iptables开启端口:

    iptables -I INPUT  -p tcp  --dport 41000:42000  -j ACCEPT

    在启用防火墙的情况下,要加载内核ip_conntrack_ftp   ip_nat_ftp

    #modprobe ip_conntrack_ftp
    #modprobe ip_nat_ftp

     iptables重启需要再次加载该模块

    7.锁定目录

    chroot_list_enable=YES
    # (锁定目录)
    #chroot_list_enable这里为YES时,将调用下面文件
    chroot_list_file=/etc/vsftpd.chroot_list

    终端:vi /etc/vsftpd/chroot_list
    user
    test
    admin

    7.如果出现错误提示:

    ftp服务器连接失败,错误提示:

    500 OOPS: cannot changedirectory:/home/*******

    500 OOPS: child died

    解决方法:

    在终端输入命令:

    setsebool ftpd_disable_trans 1

    service vsftpd restart

    8.如果反复出现错误提示:530 Permission denied.

    请清空/etc/pam.d/vsftpd文件

    粘贴以下内容:

    #%PAM-1.0

    session optional pam_keyinit.so force revoke
    auth required pam_shells.so
    auth include system-auth
    account include system-auth
    session include system-auth
    session required pam_loginuid.so

    重启vsftpd

  • 相关阅读:
    Visual Studio 必备神器
    MVC中用Jpaginate分页 So easy!(兼容ie家族)
    仿花田:相亲网站 意中人 已在GitHub上开源
    仿花田:内部相亲网站 意中人(Asp.net MVC,Bootstrap2)
    Myeclipse最全快捷键
    SVG Viewer 3.0安装发现SVG Viewer License.txt无法介入写入,安装失败
    SVG报错error on line 39 at column 26: Namespace prefix xlink for href on script is not defined
    SVG可缩放矢量图形
    Google帮助IE浏览器实现对SVG支持
    JS代码判断IE6,IE7,IE8,IE9的函数代码
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429470.html
Copyright © 2011-2022 走看看