• 幕客老师召集小伙伴
  • 运维高手36项修炼
  • python自动化运维项目实战
  • nginx从入门到实战
  • 阿里云与Centos7实战

DevOPS-环境搭建

一、环境搭建

1、基础开发库

yum install gcc-c++

yum install nmap nmap-devel

2、安装数据库和开发库

yum install mysqld mysql-devel

二、搭建内容

1、python环境

tar  -xvf Python-2.7.10.tar.xz 
cd Python-2.7.10/
./configure --prefix=/opt/python2.7
make
make install
echo "export PATH=/opt/python2.7/bin:\$PATH" > /etc/profile.d/python.sh
echo $PATH
which python 
mkdir ~/.python-eggs
chmod +w ~/.python-eggs
echo "export PATH=/opt/python2.7/bin:\$PATH" > /etc/profile.d/python.sh
export PATH=/opt/python2.7/bin:$PATH

2、setuptools

unzip setuptools-28.8.0.zip 
cd setuptools-28.8.0/
/opt/python2.7/bin/python ./setup.py install

3、pip安装

/opt/python2.7/bin/easy_install pip

4、拷贝代码

克隆或者拷贝代码

5 、初始化安装所需模块

 /opt/python2.7/bin/pip install -r ./requirements.txt 

pip install -r ./requirement.txt -i http://pypi.douban.com/simple/ #用国内源的方式

6、数据库部分

1)数据库字符集设置

vim /etc/my.cnf

character_set_server=utf8

init_connect='SET NAMES utf8'

 

1)创建数据库部分的授权用户

mysql> grant all on imoocc.* to admin@'www.iaskjob.com' identified by 'imoocccom';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;                                                   
Query OK, 0 rows affected (0.00 sec)

2)修改配置文件

vim settings配置文件

DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'optools',  # Or path to database file if using sqlite3.
            'USER': 'admin',  # Not used with sqlite3.
            'PASSWORD': '1231231',  # Not used with sqlite3.
            'HOST': 'www.iaskjob.com',  # Set to sempty string for localhost. Not used with sqlite3.
            'PORT': '',  # Set to empty string for default. Not used with sqlite3.
            'OPTIONS': {},
            'init_command': 'SET storage_engine=INNODB,SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED, autocommit=1, names "utf8";',
        }
    }

3)建立表结构

python manage.py migrate
python manage.py makemigrations 

三、

DevOPS-环境搭建

Pingbacks已打开。

引用地址

暂无评论

发表评论