Giter Site home page Giter Site logo

cmdb's Introduction

IT资产管理系统

GitHub Stars GitHub All Releases

图例

说明

$ 开头的行表示需要执行的命令

环境

系统: CentOS 7
目录: /opt
数据库: mariadb5.5
web: nginx

开始安装

$ firewall-cmd --zone=public --add-port=80/tcp --permanent
$ firewall-cmd --reload # 重新载入规则
$ setenforce 0
$ sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

安装依赖包

$ yum -y install epel-release
$ yum -y install git nginx

安装 Mariadb

$ yum -y install mariadb mariadb-devel mariadb-server MariaDB-shared
$ systemctl enable mariadb
$ systemctl start mariadb

创建数据库 Cmdb 并授权

$ DB_PASSWORD='iamadmin' # 设置数据库密码
$ mysqladmin -uroot password $DB_PASSWORD
$ mysql -uroot -p$DB_PASSWORD -e "create database cmdb default charset 'utf8';
grant all on cmdb.* to 'cmdb'@'127.0.0.1' identified by '$DB_PASSWORD'; flush privileges;"

安装 Python3.6

$ yum -y install python36 python36-devel

配置并载入 Python3 虚拟环境

$ cd /opt
$ python3.6 -m venv py3 # py3为虚拟环境名称, 可自定义
$ source /opt/py3/bin/activate # 退出虚拟环境可以使用 deactivate 命令

看到下面的提示符代表成功

$ (py3) [root@localhost py3]

下载IT资产管理系统

$ cd /opt/
$ git clone --depth=1 https://github.com/SuperLandy/cmdb.git

安装 Python 库依赖

$ pip install --upgrade pip setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple
$ pip install -r /opt/cmdb/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

修改 cmdb 数据库配置文件

$ cd /opt/cmdb/cmdb/
$ cp settings_example.py settings.py
$ vi settings.py

DATABASES = {
'default': {  
    'ENGINE': 'django.db.backends.mysql',  
    'NAME': 'cmdb',  
    'USER': 'cmdb',  
    'PASSWORD': 'iamadmin',  
    'HOST': '127.0.0.1',  
    'PORT': '3306',  
}  

}

配置nginx

$ vi /etc/nginx/conf.d/cmdb.conf

server {

    listen 80;
    server_name www.example.com;
    location ~/static {
            root  /opt/cmdb/;
    }
    location / {
            index index.html;
            proxy_pass http://127.0.0.1:8080;
    }

}

启动项目

$ chmod +x /opt/cmdb/start.sh
$ /opt/cmdb/start.sh
$ systemctl start nginx

创建超级管理员

$ cd /opt/cmdb/
$ source /opt/py3/bin/activate
$ python manage.py createsuperuser #根据提示输入账号密码

更新

$ source /opt/py3/bin/activate
$ cd /opt/cmdb/ && git pull

cmdb's People

Contributors

superlandy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cmdb's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.