django+centos+cx_ Oracle development environment setup

Time:2021-12-2

Set fixed IP for Linux

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.0.116
NETMASK=255.255.0.0
GATEWAY=192.168.0.1
ONBOOT=yes
TYPE=Ethernet

Restart the configuration file for it to take effect

/etc/init.d/network restart

PIP installation

tar -xzvf pip-1.5.4.tar.gz
pip install xxx -i http://pypi.douban.com/simple

Django installation

slightly

Oracle client installation

./centos_ cx_ The oracle.sh file is as follows:

#!/bin/bash

# INSTALL ORACLE INSTANT CLIENT #
#################################

# NOTE: Oracle requires at least 1176 MB of swap (or something around there).
# If you are using CentOS in a VMWare VM, there's a good chance that you don't have enough by default.
# If this describes you and you need to add more swap, see the
# "Adding a Swap File to a CentOS System" section, here:
# http://www.techotopia.com/index.php/Adding_and_Managing_CentOS_Swap_Space

# Install basic dependencies
sudo yum -y install libaio bc flex

echo "Now go get some the following two RPMs ..."
echo "- basic: oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm"
echo "- SDK/devel: oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm"
echo "... from this URL: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html"
echo "WARNING: It's pretty annoying, they make you sign up for an Oracle account, etc."
echo 'I will assume you have put these two files are into ~/Downloads'
echo "Press any key once you're ready" && read -n 1 -s

sudo rpm -ivh ~/Downloads/oracle-instantclient11.2-basic-*
sudo rpm -ivh ~/Downloads/oracle-instantclient11.2-devel-*
sudo rpm -ivh ~/Downloads/oracle-instantclient11.2-sqlplus-*


# SET ENVIRONMENT VARIABLES #
#############################

# Source for this section: http://cx-oracle.sourceforge.net/BUILD.txt

# (SIDENOTE: I had to alter it by doing some digging around for where the Oracle RPMs really installed to;
# if you ever need to do this, do a command like this:
#     rpm -qlp )

echo '# Convoluted undocumented Oracle bullshit.' >> $HOME/.bashrc
echo 'export ORACLE_VERSION="11.2"' >> $HOME/.bashrc
echo 'export ORACLE_HOME="/usr/lib/oracle/$ORACLE_VERSION/client64/"' >> $HOME/.bashrc
echo 'export PATH=$PATH:"$ORACLE_HOME/bin"' >> $HOME/.bashrc
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$ORACLE_HOME/lib"' >> $HOME/.bashrc
. $HOME/.bashrc

# INSTALL cx_Oracle #
#####################

pip install cx_Oracle

Then let the new environment take effect source ~ /. Bash_ profile

cx_ Oracle installation

error: command 'gcc' failed with exit status 1
yum -y install gcc-* libxml2-devel python-devel mysql-devel

If CentOS default source is

Open the file / etc / resolv.conf and add:
nameserver 8.8.8.8
Then restart the network card: use the command: service network restart
/usr/lib/oracle/11.2/client64/network/admin/tnsnames.ora

x =  

Add the following to / etc / profile

 
export ORACLE_HOME=/usr/lib/oracle/11.2/client64  
export TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/  admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib;

Then let the new environment take effect source / etc / profile

Then install the PIL library

The verification code generated with PIL appears: importerror: the_ imagingft C module is not installed
This is because PIL does not compile freetype

JPEG library needs to be installed first
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar -zxvf jpegsrc.v7.tar.gz
cd jpeg-7
CC="gcc -arch x86_64"
./configure --enable-shared --enable-static
make
make install
Then install the PIL library

The method of making PIL support freetype
1. Install freetype development library
yum install freetype-devel

2. Download source code
http://effbot.org/downloads/Imaging-1.1.7.tar.gz

3. Modify the setup.py file

JPEG_ROOT = libinclude("/usr/local")
FREETYPE_ROOT = '/usr/lib64','/usr/include/freetype2/freetype'

4. View support items
python setup.py build_ext -i
—FreeType2 support available note this

5. Compile and install
python setup.py install
If the above settings fail, you can only take out the following killer mace:

sudo apt-get build-dep python-imaging
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
pip install -U PIL

When the following prompt appears, the installation is successful:

——————————————————————–PIL 1.1.7 SETUP SUMMARY——————————————————————–version 1.1.7platform linux2 2.7.3 (default, Apr 10 2012, 22:21:37) [GCC 4.6.3]———————————————————————– TKINTER support available— JPEG support available— ZLIB (PNG/ZIP) support available— FREETYPE2 support available*** LITTLECMS support not available——————————————————————–

Djangocaptcha installation

Used for verification code generation

Xlwt installation

pip install xlwt

Unipath installation

pip install unipath

ORA-21561: OID generation failed

Add 127.0.0.1 host name to / etc / hosts

Turn off firewall

iptables -F

Django test

Settings file modification:

DEBUG = True
INTERNAL_IPS = ('127.0.0.1', '192.168.1.100')

Cron service

/sbin/service crond start
/sbin/service crond stop
/sbin/service crond restart
/sbin/service crond reload

Web server time synchronization

ntpdate time.nist.gov