Detailed Explanation of linux crm Deployment Code
- 2021-07-22 11:55:17
- OfStack
linux Basic Configuration
python3 Adj. linux Environment compilation and installation
1.linux How to install software under
- Preferred yum Tools, convenient, self-resolving dependencies between software, automatic download and installation
1. Configure yum Source (that is, 1 A software warehouse, which contains 1 Heap rpm Software package)
You can choose Alibaba Yunyuan and Tsinghua yum Source
Configuration section 1 Warehouse, which contains a large number of commonly used system software
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
You also have to configure the 2 Warehouses, carrying a large number of 3 Party software ( nginx , redis , mongodb , mairadb Etc.)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2. You have to understand yum Warehouse directory of
cd /etc/yum.repos.d/ # In this directory 1 Layered repo The file will be identified and asked yum Software repository
3. Empty yum Cache, empty centos Official yum Software cache
yum clean all
4. Generate a new Alibaba Cloud yum Cache
yum makecache
-wget In 1 Resources url The command of
-apt-get ubuntu Underneath yum
- Use yum Warehouse, not only can you use the first 3 Square yum Warehouse, you can still designate the official yum Source ( Like mariadb Official database yum Source, the latest software package )
-rpm Manual installation, you have to deal with dependencies
- Free choice of version, and can extend the 3 The installation method of square function is called source code compilation and installation
View dependent modules
pip3 freeze > requirements.txt
# This requirements.txt The file is python Module dependency files known to programmers
Step 1. Start the mariadb database
Configuring the yum source
1.yum
Configure yum Source
yum install mariadb-server mariadb -y
2. Pass yum Installed software, how to start
systemctl start mariadb
# systemctl start/stop/status/restart mariadb
3. Login database
cmd Login
Export the database of windows and import it to linux machine
cmd Login export command
mysqldump -uroot -p se_crm > se_crm.sql # Specifies that the database is exported to se_crm.sql In this data file,
Transfer to linux Import in
Simple use lrzsz Tool transmission
Or download xftp Tools
Command to import data
mariadb Installation
yum install mariadb-server
Mode 1 :
1. Create 1 A se_crm Database
create database se_crm;
# Command to import data
mysql -uroot -p se_crm < /opt/se_crm.sql # Specify se_crm Database, import 1 A sql Documents
Mode 2 :
After logging in to the database, import the data with the command
1. Create 1 A se_crm Database
create database se_crm;
2. Switch databases
use se_crm;
3. Read sql File, write to dataset
mareiadb> source /opt/se_crm.sql;
Step 2: Prepare the python3 environment and the virtual environment
Compile and install python3 to solve environment variables
How to compile and install python3 under centos7
1. You must address the underlying development environment required for compilation
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
2. Download the coding package for python3
Decompression
wget https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tar.xz
xz -d Python-3.6.7.tar.xz
tar -xf Python-3.6.7.tar
4. Enter the source folder generated by decompression
cd Python-3.6.7
5. Execute the command to compile the 3-part
Find a [configured executable file, configure], execute it, and specify the software installation location
./configure --prefix=/opt/python367/
Song 2: In the previous step, an makefile will be generated, which will be compiled and installed. Under linux, the gcc tool must be used to compile, and the command used is make
make
Song 3: This 1 step is to perform the installation, which will generate the/opt/python367 folder with all the available interpreters here
make install
6. Configure environment variables for quick use of python3
1. Get the current PATH variable and add the bin directory of python3
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin2. Permanently modify the value of PATH
-The first is the soft connection
-Directly modification/etc/profile, the global configuration file of the system, which will be loaded when each user logs in to the system
vim /etc/profile
Write a new PATH variable
PATH="/opt/python367/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin"
3. You have to log in again, or read this/etc/profile manually
source/etc/profile # Make the variables in this file effective
Download the virtualenvwrapper tool
virtualenvwrapper, an upgraded virtual environment tool
1. Install without activating the virtual environment
pip3 install -i https://pypi.douban.com/simple virtualenvwrapper
2. Modify the configuration file and load the virtualenvwrapper tool every time you boot up1. Open 1 user's personal environment variable profile
Global Profile/etc/profile # Effective for each user login
User Profile ~ /.bash_profile
vim ~/. bash_profile # root will read the code in this file when logging in
2. Fill in the following information and modify it for your own python environment
export WORKON_HOME= ~/Envs # Set virtualenv's Unified 1 Management Directory
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS= '--no-site-packages' # Add virtualenvwrapper parameters to create a clean and isolated environment
export VIRTUALENVWRAPPER_PYTHON=/opt/python367/bin/python3.6 # Specifies an python interpreter
source/opt/python367/bin/virtualenvwrapper. sh # Execute the virtualenvwrapper installation script
3. At this point, you can use this tool to quickly create a virtual environment
mkvirtualenv Virtual Environment Name # Create Virtual Environment
lsvirtualenv # Lists the names of virtual environments
workon Virtual Environment Name # Activate or Switch Virtual Environment
lssitepackages # lists the module information in the virtual environment, which is
cdvirtualenv # Enter Virtual Environment Home Directory
cdsitepackages # Enter the third-party module directory of virtual environment
Use the mkvirtualenv command to create a new virtual environment to start crm
mkvirtualenv s23_crm
Copy the crm code to the linux machine
rz # Speak crm Drag the project package to linux,
# Decompression
Solve the dependent environment required by crm, django and other modules, and pymysql
Solution 1:
Stupid way, report mistakes one by one to see and solve them
pip3 install -i https://pypi.douban.com/simple django==1.11.23
pip3 install -i https://pypi.douban.com/simple pymysql
pip3 install -i https://pypi.douban.com/simple django-multiselectfield
pip3 install -i https://pypi.douban.com/simple django==1.11.23A less stupid way:
Command for exporting python interpreter module
pip3 freeze > requirements. txt # This requirements. txt file is a module dependency file known to python programmersInstall all modules in this requirements. txt file
pip3 install-r requirements. txt # Specifies dependency file installation and reads all module information in the file
The above is all the relevant knowledge points introduced this time. Thank you for your study and support for this site.