顯示具有 CentOS 標籤的文章。 顯示所有文章
顯示具有 CentOS 標籤的文章。 顯示所有文章

2014年4月7日 星期一

CentOS compile moswsgi with Python 2.7

# yum install mercurial httpd-devel
$ hg clone https://code.google.com/p/modwsgi/
$ cd modwsgi/mod_wsgi
$ ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python2.7
$ make
# make install
# vi /etc/httpd/conf/httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so




References :
Running our Django site with mod_wsgi and virtualenv (part 2) | techno milk

2014年4月2日 星期三

CentOS 6 install Python 2.7

# Python 2.7.6:
$ wget https://www.python.org/ftp/python/2.7/Python-2.7.tgz
$ tar zxf Python-2.7.tgz
$ cd Python-2.7.6
$ ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
# make && make altinstall
 
# First get the setup script for Setuptools:
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
 
# Then install it for Python 2.7
# python2.7 ez_setup.py
 
# Now install pip using the newly installed setuptools:
# easy_install-2.7 pip
 
 
 
 
References :

2014年3月12日 星期三

CentOS pip install MySQL-python

Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-HGn8ZB-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/MySQL-python

Storing debug log for failure in /root/.pip/pip.log


# yum install gcc python-devel mysql-devel

unable to execute gcc: No such file or directory

# yum install gcc

2013年12月9日 星期一

CentOS firewall config

# vi /etc/sysconfig/iptables
# HTTP
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

# NFS
-A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT

# Samba
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT
# /etc/init.d/iptables restart




References:
CentOS / Redhat Iptables Firewall Configuration Tutorial

2013年10月2日 星期三

CentOS Mysql 遠端連線

vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT


Reference :
How Do I Enable Remote Access To MySQL Database Server?

2013年8月28日 星期三

Temporarily disable SELinux

# echo 0 >/selinux/enforce

# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted




Reference :
HowTo: Temporarily Switch Off SELinux Enforcement

2013年8月27日 星期二

CentOS install Samba server

// install
# yum install samba samba-client samba-common -y

// firewall
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

# /etc/init.d/iptables restart

// add samba user
# smbpasswd -a user1 // 須在系統上有相同的帳號

// set share directory
# vi /etc/samba/smb.conf
[global]
    security = user
[share]
     comment = Share Storage
     path = /mnt/datadisk
     browsable = yes
     guest ok = yes
     read only = no
     valid users = user1 user2

// restart services
# /etc/init.d/smb restart




Reference :
Samba Add a User

CentOS install NFS Server

Server :
# yum install nfs* -y

# vi /etc/exports
/mnt/data 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)

# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
-A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT

:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

# /etc/init.d/iptables restart
# /etc/init.d/rpcbind restart
# /etc/init.d/nfs restart

Client  :
# yum install nfs* -y
# /etc/init.d/rpcbind restart
# /etc/init.d/nfs restart
# mount -t nfs 192.168.1.200:/mnt/data/ /nfs/shared/




Reference :
Setup NFS Server in CentOS / RHEL / Scientific Linux 6.3 Step by step | Ostechnix

CentOS install nginx

# vi  /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
# yum install nginx -y

# /etc/init.d/nginx restart





Reference :
Install
RHEL / Centos 6: Install Nginx Using Yum Command

2012年9月26日 星期三

yum 無法更新、安裝時錯誤

yum 無法更新、安裝時錯誤

# yum update

# yum install xxxx
[Errno 4] IOError:




嘗試解法:

1. 確定套件源沒問題

2. DNS 是否無法查詢

# vi /etc/resolv.conf
nameserver 168.95.1.1
nameserver 8.8.8.8




Reference :
CentOS 更新失敗 @ 文森特の灰肝誌 :: 痞客邦 PIXNET ::
yum源urlopen error错误 - B612号小行星 - 51CTO技术博客