分类: Linux

  • CentOS 7 x86_64适用的EPEL安装源 国内镜像列表

    EPEL 是 Extra Packages for Enterprise Linux 的缩写(EPEL),是用于 Fedora-based Red Hat Enterprise Linux (RHEL) 的一个高质量软件源EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。

    epel468x120

    安装EPEL源

    官方源直接安装

    rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

    国内的往往速度会更快

    #中科大镜像源 高质量源
    rpm -Uvh http://mirrors.ustc.edu.cn/centos/7.0.1406/extras/x86_64/Packages/epel-release-7-5.noarch.rpm
     
    #浙大源 也非常不错
    rpm -Uvh http://mirrors.zju.edu.cn/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
     
    #上海交大源,更新比较快
    rpm -Uvh http://ftp.sjtu.edu.cn/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    
    #还有东北的活雷锋东软的源,最近有些抽风,经常打不开
    http://mirrors.neusoft.edu.cn/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    
    #sohu镜像源,更新比较慢 
    rpm -Uvh http://mirrors.sohu.com/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm

    这是来自官方公布的数据(2015-01-28)

    http://mirrors.fedoraproject.org/publiclist/EPEL/7/x86_64/#CN

    配置EPEL源

    vi /etc/yum.repos.d/epel.repo

    [epel]
    name=Extra Packages for Enterprise Linux 7 - $basearch
    baseurl=http://ftp.sjtu.edu.cn/fedora/epel/7/$basearch
    #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
    failovermethod=priority
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    
    [epel-debuginfo]
    name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
    baseurl=http://ftp.sjtu.edu.cn/fedora/epel/7/$basearch/debug
    #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    gpgcheck=1
    
    [epel-source]
    name=Extra Packages for Enterprise Linux 7 - $basearch - Source
    baseurl=http://ftp.sjtu.edu.cn/fedora/epel/7/SRPMS
    #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    gpgcheck=1

    vi /etc/yum.repos.d/epel-testing.repo

    [epel-testing]
    name=Extra Packages for Enterprise Linux 7 - Testing - $basearch
    baseurl=http://ftp.sjtu.edu.cn/fedora/epel/testing/7/$basearch
    #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    
    [epel-testing-debuginfo]
    name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Debug
    baseurl=http://ftp.sjtu.edu.cn/fedora/epel/testing/7/$basearch/debug
    #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    gpgcheck=1
    
    [epel-testing-source]
    name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Source
    baseurl=http://ftp.sjtu.edu.cn/fedora/epel/testing/7/SRPMS
    #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&arch=$basearch
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    gpgcheck=1
    

    这是已经替换好上海交大源的文件,如果想使用中科大的,请用http://mirrors.ustc.edu.cn/来替换http://ftp.sjtu.edu.cn/fedora/就可。其它以此来推。

    检查源是否已添加

    yum repolist
    

    运行命令生成缓存

    yum clean all && yum makecache

    选择速度最快的yum源

    yum安装插件yum-plugin-fastestmirror

    yum install yum-plugin-fastestmirror

     

  • CentOS 7 64bit Minimal安装后的初步10项优化和配置(更新epel和remi源安装)

    CentOS官方于2014年7月7日发布64位CentOS 7.0.1406开始,不知不觉已快半年了。也已经有越来越多的软件开始支持CentOS7了。ITGeeker也尝试将越来越多的服务架构于其之上。

    CentOS 7是一个大版本更新,应该有不少提升。连服务的启动停止命令也有了很大的变化。

    CentOS 6及之前:

    service httpd restart

    CentOS 7:

    systemctl start httpd.service

    centos7

    1. 更新系统并安装必备的组件

    yum upgrade or yum update
    yum install wget telnet perl perl-devel net-tools kernel-devel 
    yum groupinstall "Development tools" -y

    安装这些之后会大大方便今后安装其他应用是碰到的依赖包问题。其中net-tools是为了提供dig, nslookup, ipconfig等命令,方便配置CentOS 7初始化网络环境。如果不安装这个,在CentOS 7中,可以使用ip addr命令来代替ipconfig进行当前ip地址查询。

    2. 添加源(repository)REMI & EPEL

    yum安装时,要想安装比较新的版本软件,可以试试这两个源。都有一些国内镜像,我添加的EPEL是阿里云镜像的。

    这是适合CentOS 6的源

    cd /tmp && wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && wget http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm && rpm -Uvh remi-release-6.rpm epel-release-6-8.noarch.rpm

    真正适合CentOS 7的epel和remi源

    rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

    如果国外没法用,那用国内的镜像源

    #中科大镜像源
    rpm -Uvh http://mirrors.ustc.edu.cn/centos/7.0.1406/extras/x86_64/Packages/epel-release-7-5.noarch.rpm
    
    #浙大源
    rpm -Uvh http://mirrors.zju.edu.cn/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    
    #上海交大源
    rpm -Uvh http://ftp.sjtu.edu.cn/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    
    #sohu镜像源,更新比较慢 
    rpm -Uvh http://mirrors.sohu.com/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
    

    使用方法:

    yum --enablerepo=remi install php mysql php-mysql mysql-server phpmyadmin 
    
    或者
    
    yum --enablerepo=epel install php mysql php-mysql mysql-server phpmyadmin

    3. FQDN配置,全称Fully Qualified Domain Name

    有些软件,特别是邮件系统对这个要求比较高。

    vi /etc/hosts
    
    127.0.0.1 localhost.localdomain localhost geeker
    ::1 localhost.localdomain localhost geeker
    
    vi /etc/sysconfig/network
    HOSTNAME=geeker
    
    设置好之后,查询是否完整
    
    hostname -f

    4. 关闭Selinux

    这是Centos系统的安装机制,单单往往导致很多软件无法正常安装,让我们关掉它吧!

    /etc/selinux/config
    在 SELINUX=enforcing 前面加个#号注释掉它
    #SELINUX=enforcing
    然后新加一行
    SELINUX=disabled
    #SELINUXTYPE=targeted #注释掉这行

    保存,退出,重启系统,搞定。

    不想重启,可以使用

    setenforce 0 #使配置立即生效

    5. CentOS 7的防火墙关闭和iptables安装

    CentOS 7.0默认使用的是firewall作为防火墙,但可能一下子很难适应,让我们先改回原先的iptables防火墙吧!

    关闭CentOS 7的firewall:

    systemctl stop firewalld.servic #停止firewall
    systemctl disable firewalld.service #禁止firewall开机启动

    安装iptables防火墙

    yum install iptables-services #安装
    vi /etc/sysconfig/iptables #编辑防火墙配置文件

    启动iptables防火墙

    systemctl restart iptables.service #最后重启防火墙使配置生效
    systemctl enable iptables.service #设置防火墙开机启动

    6. 本地SMTP邮件发送功能(Postfix)

    很多软件和服务可以用到这个功能给用户发送通知邮件,需要配置一下。

    最好加上一个认证,使用Postfix + Saslauthd

    yum remove sendmail   #如果有原先的sendmail,先移除
    yum install postfix   
    vi /etc/postfix/main.cf   #编辑postfix主配置文件
    useradd itgeeker   #增加用户
    passwd itgeeker   #设置用户密码
    yum install cyrus-sasl*
    
    /bin/systemctl restart saslauthd.service && /bin/systemctl restart postfix.service   #启动postfix和saslauth服务

    最好用telnet测试一下,前面安装的telnet就发挥作用了。

    telnet localhost smtp
    ehlo localhost
    mail from:
    rcpt to:<alanljj@qq.com>
    data
    Welcome to itgeeker mail server
    .
    quit
    #查看邮件内容
    less /var/log/maillog
    cd /root/Maildir/new #注意M要大写
    ll
    cat ***** #*代表列出的文件名,可以查看新的邮件内容
    vi /var/log/maillog
    Tips小技巧:
    有时候telnet登陆后就退不出来了ctrl+c也不管用此时可以使用ctl+] 切换,然后quit退出。

    7.  CentOS 7时间同步及更改

    和之前基本一样:

    date
    
    yum install ntpdate -y
    ntpdate time.windows.com && hwclock -w
    
    #连网更新时间,如果成功,将系统时间,写入BOIS
    
    hwclock -w 或 hwclock --systohc
    
    date -s 20150119
    date -s 17:28:00

    8. Shell登陆操作显示中文乱码问题(和CentOS 6一样,问题还是存在)

    方法一:

    vi /etc/sysconfig/i18n 文件中修改LANG的设置为:
    #LANG="en_US.UTF-8"
    #SYSFONT="latarcyrheb-sun16"
    LANG="zh_CN.GBK"
    LANGUAGE="zh_CN.GBK:zh_CN.GB18030:zh_CN.GB2312:zh_CN"
    SUPPORTED="zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en"
    SYSFONT="lat0-sun16"
    
    然后在/etc/profile文件中增加export LC_ALL=zh_CN.GBK内容。使得全部的LC*都统一了。
    
    重启主机

    方法二: 更改shell的显示语言

    ITGeeker技术奇客使用的是xshell,直接在当前链接的属性-终端-选择UTF-8为编码即可。如果你经常使用变换使用shell,那就用第一种方法吧。

    9. FTP服务安装(vsftpd安装)

     

    为主机开通FTP服务还是非常有必要的,我们为主机快速安装vsftpd吧。

    可以参考详细教程 CentOS6.5 64bit如何安装配置FTP服务(vsftpd)

    yum install vsftpd -y
    vi /etc/vsftpd/vsftpd.conf
    
    #记得CentOS 7启动命令有所不同
    
    systemctl restart vsftpd
    systemctl enable vsftpd

    10.  Vmware Tools安装

    如果你使用的是虚拟机,那最好装一下Vmware Tools

     

    先点击Vmwar虚拟机管理界面菜单,虚拟机–安装Vmware Tools安装。

    mkdir /mnt/cdrom && mount -t iso9660 /dev/cdrom /mnt/cdrom && cd /mnt/cdrom && cp VMwareTools-9.6.2-1688356.tar.gz /root
    
    mount -t iso9660 /dev/cdrom /mnt/cdrom && cd /mnt/cdrom && cp VMwareTools-9.6.2-1688356.tar.gz /root
    
    cd /root && tar zxvf VMwareTools-9.6.2-1688356.tar.gz && cd vmware-tools-distrib
    
    安装vmware tools
    ./vmware-install.pl

    中间的问题全部选择默认,可能会有错误提示,基本没啥问题。

    依赖包,如果有需要 yum -y install perl perl-devel

    请使用你的版本代替VMwareTools-9.6.2-1688356.tar.gz

  • CentOS6.5如何修改和设定FQDN

    FQDN是Fully Qualified Domain Name的缩写, 含义是完整的域名. 例如, 一台机器主机名(hostname)是www, 域后缀(domain)是itgeeker.net, 那么该主机的FQDN应该是www.itgeeker.net.

    FQDN-itgeekr

    1. FQDN查询命令

    hostname -f
    #显示全域名(FQDN,Fully Qualified Domain Name)

    2. 设置Linux的FQDN方法(永久修改)

    /etc/sysconfig/network + /etc/hosts文件组合修改

    a. vi /etc/sysconfig/network 配置文件

    NETWORKING=yes
    HOSTNAME=localcentos6.itgeeker.net #此处输入你想显示的主机名

     b. 在/etc/hosts文件中增加一行主机记录

    第一个字段是该主机的IP地址, 第二个字段是你希望设置的FQDN, 最后是刚刚设置的主机名。

    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    #原始的可以保留不变
    
    192.168.188.200 localcentos6.itgeeker.net localcentos6

    #如果ip地址使用环回地址127.0.0.1,结果还是不对,在重启httpd会告诉你无法确定你的FQDN

    [root@localcentos6 ~]# service httpd restart
    Stopping httpd:        [FAILED]
    
    Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                          [  OK  ]

    #注意顺序,网上有把hostname主机名localcentos6放在fqdn前面的就是192.168.188.200 localcentos6 localcentos6.itgeeker.net 结果用hostname -f查出来是不是fqdn.正确顺序应该是:

    ip fqdn hostname

    设置好之后, 重启主机就可以看到新的主机名了。

    通过hostname -f看到的FQDN就应该是:

    localcentos6.itgeeker.net
  • CentOS6.5 64bit如何关闭Selinux

    SELinux是「Security-Enhanced Linux」的简称,是美国国家安全局「NSA=The National Security Agency」 和SCC(Secure Computing Corporation)开发的 Linux的一个扩张强制访问控制安全模块。

    selinux

    但是SElinux是php的天敌,经常由于CentOS系统默认系统的安全性配置导致些莫名其妙的问题,比如SElinux本来是用于安全子系统的权限控制,可是搞不好就发现限制多多。所以很多软件安装之前要求关闭SElinux.

    如何查看SELinux状态?

    1. SELinux status参数为enabled即为开启状态

    /usr/sbin/sestatus -v
    SELinux status: enabled

    2、getenforce命令检查

    如何关闭SElinux

    1. 临时快速关闭SElinux,不用重启机器

    /usr/sbin/setenforce 0 立刻关闭 SELINUX
    /usr/sbin/setenforce 1 立刻启用 SELINUX

    2. 在启动时加载Selinux禁用命令行

    echo "/usr/sbin/setenforce 0" >> /etc/rc.local

    3. 编辑配置文件达到一劳永逸,当然会对安全有所影响

    vi /etc/selinux/config
    
    #SELINUX=enforcing #注释此行
    #SELINUXTYPE=targeted #注释此行
    
    SELINUX=disabled #增加此行
    
    :wq 保存并关闭
    
    shutdown -r now #重启系统

     

  • CentOS 6 64-bit如何安装Webmin1.700 Linux管理器

    如果你是一个ITGeeker,喜欢用Shell敲打命令,并且觉得那样很酷,那就没必要安装Webmin. 如果你有时候想使用图形界面来调整或更改Linux的某些设置,那么Webmin是你绝佳的选择。

    webmin

    Webmin是一个开源的基于网页的Unix/Linux系统管理工具。通过使用Webmin,你可以在浏览器上设置和安装所有的系统服务,包括:DNS、DHCP、Apache、NFS和Samba等等。因此,有了Webmin,你就再也不需要去记住所有的修改配置的命令了。

    Webmin最新的版本是1.700,已经支持CentOS 7了。官方下载页面:http://webmin.com/download.html

    RPM安装 Webmin 1.700 16.3 MB

    RPM suitable for Redhat, Fedora, CentOS, SuSE or Mandrake Linux

    1. 下载RPM文件

    cd /tmp && wget http://prdownloads.sourceforge.net/webadmin/webmin-1.700-1.noarch.rpm

    2. 安装命令

    rpm -i webmin-1.700-1.noarch.rpm

    3. 打开操作界面

    记得打开防火墙10000端口
    
    http://youripaddress:10000
     用户名root,密码就是root密码

     Webmin密码更改

    #/usr/libexec/webmin/changepass.pl /etc/webmin admin

     Webmin卸载

    #/etc/webmin/uninstall.sh

     

     

     

奇客罗方公众号 奇客罗方小程序 奇客罗方客服 ITGeeker Telegram

网站由ITGeeker技术奇客开发并管理;隶属于GeekerCloud奇客罗方智能科技
Site designed and developed by ITGeekerwhich is a sub-website of GeekerCloud
网站地图 | 沪ICP备2021031434号-4