标签: repository

  • phpPgAdmin连接postgresql数据库的配置 CentOS6_64bit

    phpPgAdmin是Postgresql的图形化操作界面,但是很多ITGeeker往往在安装的时候很难一次性成功,根据多次实践,技术奇客在此与大家分享实战经验,此案例以postgresql9.3版本为例。

     

    确认一下是否已安装Postgresql数据库并启动:

    netstat -lnp|grep 5432

    1. 安装图形客户端phppgadmin

    yum install phpPgAdmin

    如果没有,安装一下EPEL源吧

    yum install epel-release

     

    2. phpPgAdmin.conf配置

    vi /etc/httpd/conf.d/phpPgAdmin.conf

    Alias /phpPgAdmin /usr/share/phpPgAdmin
    
    <Location /phpPgAdmin>
        Order allow,deny
    #   Deny from all
        Allow from all
    #   Allow from 127.0.0.1
        Allow from ::1
    # Allow from .example.com
    </Location>

    把Allow from改为客户端的ip地址或者本地127.0.0.1(安全性更好),或者改为Allow from all也可。

    3. pg_hba.conf配置

    vi /var/lib/pgsql/9.3/data/pg_hba.conf
    主要修改ipv4部分内容,都改成trust,这样最省事。

    # IPv4 local connections:
    host all all 127.0.0.1/32        trust
    host all all your IP/24          trust
    host all all your company IP/24  trust

    可以只添加公司的公网ip和自己家里的ip地址,这样比较安全。

    修改认证方式,将md5改为trust,然后保存

    4. postgresql.conf配置

    vi /var/lib/pgsql/9.3/data/postgresql.conf

    listen_addresses = '*'

    此处主要修改监听本地为监听所有ip,方便远程登入用。

    5. phpPgAdmin.conf配置

    vi \etc\httpd\conf.d\phpPgAdmin.conf

    Alias /phpPgAdmin /usr/share/phpPgAdmin
    
    Order allow,deny
    # Deny from all
    Allow from all
    # Allow from 127.0.0.1
    Allow from ::1
    # Allow from .example.com

    这里一定要配置好allow from all,不要让deny在前面,否则无法登入。

    6. phpPgAdmin的config.inc.php配置

    \usr\share\phpPgAdmin\conf\config.inc.php
    第18行改为

    $conf['servers'][0]['host'] = 'localhost';

    修改未localhost本地还是其它ip就看你要从哪里登入了。

    7. 现在准备登入phpPgAdmin了

    service httpd restart

    重启web apache服务

    service postgresql-9.3 restart

    重启postgresql服务,使刚才做的修改生效。
    访问 http://your ip address/phpPgAdmin/

    注意区分phpPgAdmin的大小写

    在Postgresql的web管理界面,输入登陆名及密码 -安装数据库时创建的用户和密码

     

    8. 相关问题及碰到困难

     

    1. 重置PostgreSQL密码:

     

     

    sudo - postgres
    
    psql
    
    #ALTER USER postgres with password '你的密码';
    \q
    
    exit
    或者有时需要重置postgres用户的linux密码:
    sudo passwd -d postgres 删除linux postgres的密码
    sudo -u postgres passwd 创建linux postgres的密码

     

     

    2. 如果碰到403 forbidden,请检查文件夹权限。

    3. 浏览器提示“您的 PHP 中没有完整的数据库支持”

    这表明没有安装php和php-pgsql软件包

    yum install php-pgsql

    yum会同时安装2个依赖包php-pdo,php-common,它们的安装顺序为php-common php-pdo php-pgsql,也可以手动依次安装。

    4. 网站打开后直接显示源码

    这表明没有安装php

    yum install php

    5. 如果碰到版本冲突

    Error: Package: php-pgsql-5.3.3-40.el6_6.x86_64 (updates)
               Requires: php-common(x86-64) = 5.3.3-40.el6_6
               Installed: php-common-5.4.33-2.el6.remi.x86_64 (@remi)
                   php-common(x86-64) = 5.4.33-2.el6.remi
               Available: php-common-5.3.3-38.el6.x86_64 (base)
                   php-common(x86-64) = 5.3.3-38.el6
               Available: php-common-5.3.3-40.el6_6.x86_64 (updates)
                   php-common(x86-64) = 5.3.3-40.el6_6
     You could try using --skip-broken to work around the problem
     You could try running: rpm -Va --nofiles --nodigest

    解决方案

    rpm -qa | grep php-common 
    rpm -e --nodeps php-common-5.4.33-2.el6.remi.x86_64

    使用强制移出冲突版本需注意其它软件和它依赖的关系,否则会引起其它软件无法运行等问题。

     

  • 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 64-bit如何安装PHP

    作为LANMP组件的重要组成部分,学会快速安装和测试PHP显得非常重要。

    php

    PHP(全称:PHP:Hypertext Preprocessor,即“PHP:超文本预处理器”)是一种开源的通用计算机脚本语言,尤其适用于网络开发并可嵌入HTML中使用。PHP的语法借鉴吸收了C语言、Java和Perl等流行计算机语言的特点,易于一般程序员学习。PHP的主要目标是允许网络开发人员快速编写动态页面,但PHP也被用于其他很多领域。

    Centos Shell底下安装和测试PHP

    # yum install php -y

    安装非常简单,但要是想安装比较新的稳定版本PHP 5.4.30,可能需要更改CentOS源Repository进行安装,ITGeeker建议你参考:

     在 CENTOS 6 上安装 PHP 5.4.30

    据说新版本的PHP比原先的版本速度高出将近一倍。

    测试PHP是否安装正确

    1. 建立测试文件 “testphp.php”,放在Apache网站服务的根目录

    # vi /var/www/html/testphp.php

    2. 添加以下内容:

    <?php
    phpinfo();
    ?>

    3. 重启httpd服务

    # service httpd restart

    4. 打开页面

    http://server-ip-address/testphp.php

    testphp

    这里会显示关于PHP版本等所有的详细信息。

    如果你想让你的Mysql支持你的php,只要安装php-mysql就可以了

    # yum install php-mysql -y

    如果现在打开testphp.php文件就会看到mysql module的所有信息。

  • 在 CentOS 6 上安装 PHP 5.4.30

    安装的命令行很简单

    sudo yum --enablerepo=remi install php

    php

    不过如果你没有配置源Repository,就需要首先启动REMI源:

    cd /tmp
    wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    
    wget http://mirrors.sohu.com/fedora-epel/6/i386/epel-release-6-8.noarch.rpm

    rpm安装

    rpm -Uvh remi-release-6.rpm epel-release-6-8.noarch.rpm

    然后用remi源来安装php

    yum --enablerepo=remi install php

    确认正确的版本,回答Y开始安装。

    如何查看PHP的版本号:

    # php -v
    PHP 5.4.30 (cli) (built: Jun 25 2014 15:27:51) 
    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

    安装成功。

  • 如何在CentOs6.5_X64安装卸载LibreOffice4.2.5 by ITGeeker

    1. Yum安装方法

    安装方法有两个,如果yum已配置好,使用yum安装非常方便。

    yum install libreoffice

    但注意,此方法安装的版本并不一定是4.2.5,取决于你配置的源Repository

    安装完之后文件的目录:

    /root/libreoffice
    /usr/bin/libreoffice
    /usr/lib64/libreoffice

    LibreOffice

    2. 代码安装方法

    LibreOffice 4.2.5 64-bit version

    cd /tmp && wget http://download.documentfoundation.org/libreoffice/stable/4.2.5/rpm/x86_64/LibreOffice_4.2.5_Linux_x86-64_rpm.tar.gz && tar -xvf LibreOffice_4.2.5* && cd LibreOffice_4.2.5*

    然后安装

    yum localinstall RPMS/*.rpm

    启动Start LibreOffice

    #libreoffice4.2

    ## OR ##

    /opt/libreoffice4.2/program/soffice

    如果有问题,请根据错误提示安装依赖包,你可能需要安装:

    yum install libXinerama cups-libs

    也有可能你需要安装更多其它的依赖包,取决于你的系统配置。

    如果觉得安装依赖包太复杂,还是使用yum安装,虽然版本偏低,但非常方便。

    3. 如何删除已安装的LibreOffice

    yum remove libreoffice.org*
奇客罗方公众号 奇客罗方小程序 奇客罗方客服 ITGeeker Telegram

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