月度归档:2014年02月

ubuntu下使用bind9+mount+nginx搭建企业统一开发环境

公司内部项目较多,希望搭建一个内部环境,满足以下需求:

  1. 每次有新的项目可以不用修改host文件,产品及测试随时查看开发进度(企业内dns解析)
  2. 前端开发人员不用做复杂的服务器配置(mount+virtualhost)

安装bind9

sudo apt-get install bind9 bind9-doc bind9-host bind9utils dnsutils

开启dns缓存(可选)
sudo vim /etc/bind/named.conf.options(dns缓存)

forwarders {
  8.8.8.8;
  202.96.134.133;
  202.96.128.166;
};

增加一个域名
sudo vim /etc/bind/named.conf.local

zone "shining.dev" {
   type master;
   file "/etc/bind/db.shining.dev";
};

域名配置
sudo cp /etc/bind/db.local /etc/bind/db.shining.dev
sudo vim /etc/bind/db.shining.dev

$TTL	604800
@	IN	SOA	localhost. root.localhost. (
			      2		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@  IN  NS  localhost.
@  IN  A  10.1.0.21
*.shining.dev.  IN  A  10.1.0.21

启动&开机自动启动bind9

sudo chkconfig bind9 on
sudo service bind9 start

linux开启共享

sudo apt-get install samba
sudo vim /etc/samba/smb.conf

[share]
comment = share
path = /home/ning/project
browseable = yes
guest ok = yes
writable = yes

sudo chkconfig samba on
sudo service samba start

使用mirror给pip提速

默认配置下,使用pip安装python package速度非常慢,这时候可以考虑使用镜像. http://www.pypi-mirrors.org/

vim ~/.pip/pip.conf

[global]
trusted-host = pypi.doubanio.com
index-url = https://pypi.doubanio.com/simple/

使用命令行

pip config --global set global.index-url https://pypi.doubanio.com/simple/
pip config --global set global.trusted-host pypi.doubanio.com

更详细的pip.conf配置在:

http://www.pip-installer.org/en/latest/user_guide.html#configuration

centos6.5安装python3

安装开发工具

yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel \
 sqlite-devel readline-devel tk-devel

下载安装python

http://www.python.org/download/releases/

wget http://www.python.org/ftp/python/3.3.4/Python-3.3.4.tar.xz
tar xf Python-3.3.4.tar.xz
cd Python-3.3.4
./configure --prefix=/opt/python3
make && make install

下载安装pip

http://www.pip-installer.org/

wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
/opt/python3/bin/python3 get-pip.py

下载安装virtualenv

/opt/python3/bin/pip install virtualenv
/opt/python3/bin/virtualenv --distribute /pyproject
/pyproject/bin/pip install package