Document directory
- 1. Server Installation Steps
- 2. Account Management
- 3. Database Management
- 4. Server Directory management
- 5. server data migration
1. Server Installation Step 1.1. Install centos 51.1.1. Start the CD
Set the system to start from the CD.
Insert a centos 5 DVD or CD1 to start installation.
The following interface is displayed to select a graphical interface or character interface for installation:
You can select a graphic or character interface for installation. If you press enter directly, the graphical interface is used. If you enter Linux text, press enter to enter the character interface. In general, if the server is of an old model, such as before December 31, year 34, or all of them are mainstream hardware configurations, such as Intel servers, ATI or NVIDIA graphics cards, you can select a graphical interface; for non-mainstream hardware configuration, it is best to select the character interface. If the character interface is selected, the logon interface is the character interface after the installation is complete; otherwise, the GUI is used.
Here we select the character interface.
1.1.2. Check the CD
The check cd Page appears.
If the disk is a new optical disk, you can skip this process. If the disk has been used for a long time, you can select OK to start the test. Here, select skip to skip the test.
1.1.3. Select the installation Language
The character interface can only use English, but the selection here will directly affect the language of the later operating system. Therefore, if we want to make the language of the Operating System Chinese in the future, we should select Simplified Chinese here, although the installer automatically sets the installation language to English, after the installation is complete, the system variable Lang will be Zh. UTF-8.
1.1.4. Select the keyboard layout
Retain the default value. Continue.
1.1.5. Select the partition type
Select Custom partition here.
1.1.6. Partition
The/var directory stores the web pages of the Apache server, Oracle Data, MySQL data, and other content, which will continue to grow, so try to keep a larger space.
The/directory is the installation directory of Linux. If it is fully installed, it must be at least 5 GB.
Swap partition is a swap partition with a size of at least 2 * memory.
If Linux is fully installed, you can select automatic partitioning. Otherwise, you can perform manual partitioning as follows:
/10g +
Swap 2 * Memory
/Var rest
1.1.7. Select bootloader
Retain the default value.
1.1.8. Configure bootloader
Retain the default value.
1.1.9. Set the start Password
Retain the default value.
1.1.10. set to start other operating systems
Retain the default value.
1.1.11. Set the installation location of bootloader
Retain the default value.
1.1.12. Configure the network
You can configure the network as needed.
1.1.13. Configure gateway and DNS
Modify network configuration parameters as needed.
1.1.14. Server Name
Set the hostname.
1.1.15. Set the time zone
Select Asia/Shanghai.
Do not check "system clock uses UTC"
1.1.16. Set the password
Set the root password.
1.1.17. Select the installation package
Select "Custom" for the installation package"
1.1.18. Custom Installation
Select All installation packages except Java.
Then, the system checks the dependency of the installation package.
1.1.19. Start Installation
Click OK.
1.1.20. Prompt for media Installation
Select continue to start installation.
1.1.21. Configuration after installation
1) start for the first time
After the installation is started for the first time, a configuration interface will pop up during the startup process. You need to configure the security function:
Configure the firewall to disable SELinux.
Configure the external port of the firewall:
Open the external access permissions for telnet, ssh, HTTP, https, and FTP, and then enable UDP port 177 and TCP port from 6000 ~ 6010 to facilitate XDMCP connection configuration. Open TCP ports 1521 and 1158 to facilitate the configuration of the Oracle database.
Be sure to correctly configure the Internet so that you can install the extension package online.
2) configure the XDMCP connection
• Change the running level to 5
Open the/etc/inittab and set the init running level 5:
ID: 5: initdefault:
• Open XDMCP
For:
Enable/etc/TPD/custom. conf to set enable to 1 in the [XDMCP] Option.
[XDMCP]
Enable = 1
For KDM:
Open/usr/share/config/KDM/xaccess
Remove:
# * # Any host can get a login window
The comment symbol is changed:
* # Any host can get a login window
Open/usr/share/config/KDM/kdmrc and set:
[XDMCP]
Enable = true
3) set Chinese fonts to facilitate Oracle 10g Installation
Go to/usr/share/fonts.
Copy the Chinese directory to the zh_cn directory and enter the TrueType directory. Copy uming. TTF to zysong. TTF:
CP-R./Chinese./zh_cn
CD zh_cn/TrueType
CP./uming. TTF./zysong. TTF
4) configure the FTP server
Configure vsftpd:
Chkconfig vsftpd on
Service vsftpd start
Restart the server.
1.1.22. Configure Automatic ADSL dialing
For home networking, You need to configure ADSL automatic dialing:
ADSL-Setup
Enter the ADSL account and password as prompted.
Configure Gateway:
In/etc/sysctl. conf
# Controls IP packet forwarding
Net. ipv4.ip _ forward = 1
In/etc/sysconfig/Network
Forward_ipv4 = Yes
In/etc/rc. d/rc. Local
Service iptables restart
In/etc/sysconfig/iptables
# Firewall configuration written by petehero
# Manual customization of this file is not recommended.
# Note: IFUP-post will punch the current nameservers through
# Firewall; such entries will ** not * be listed here.
* Mangle
: Prerouting accept [0: 0]
: Input accept [0: 0]
: Forward accept [0: 0]
: Output accept [0: 0]
: Postrouting accept [0: 0]
Commit
* Nat
: Prerouting accept [0: 0]
: Postrouting accept [0: 0]
: Output accept [0: 0]
-A postrouting-s 192.168.1.0/24-O ppp0-J Masquerade
Commit
* Filter
: Input accept [0: 0]
: Forward accept [0: 0]
: Output accept [0: 0]
Commit
Now you can connect to the Internet and run the ping command to test the connection.
1.1.23. apache2 Installation
1) configure the Apache server
When the system is installed, an Apache user has been created, and the default user of the Apache server is Apache. Therefore, we set the Apache server to start with the Apache user.
Chown-r Apache: Apache/var/WWW
Usermod-D/var/www-S/bin/bash Apache
Passwd Apache
Su-Apache
CP/etc/skel/. Bash *./
Exit
Chkconfig httpd on
Edit/etc/httpd/CONF/httpd. conf, set servername, and then start Apache
# Service httpd start
Use an Apache user to create a directory under the/var/WWW directory
Mkdir backup
Mkdir Cron
Mkdir geodata
Mkdir upload
2) Remote logon is blocked with the root account.
VI/etc/ssh/sshd_config
Change # permitrootlogin yes to permitrootlogin No
Service sshd restart
1.1.24. Install MySQL
1) run the following command with the root user:
Chkconfig mysqld on
Service mysqld start
Mysql-u root-P
Modify the MySQL Root User Password.
1.1.25. PHP installation
1) run the following command with the root user:
Yum-y install PHP-devel PHP-mbstring PHP-mcrypt PHP-mhash PHP-Gd PHP-mysql PHP-pear PHP-XML
Service httpd restart
2) Upgrade the pear Library
Pear channel-update pear.php.net
Pear upgrade-all
Pear install-a log html_treemenu http_client phpunit2
3) install Dio and use the root user to enter the dio directory (whether required or not)
Phpize
./Configure; Make; make install
VI/etc/PHP. d/dio. ini
Extension = dio. So
Service httpd restart
4) install oci8 with the root user
First, here:
Http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
Download the latest ie Instant Client software, including basic and SDK
# Rpm-IVH oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm
# Rpm-IVH oracle-instantclient11.2-devel-11.2.0.1.0-1.i386.rpm
# PECL install oci8
Input:
Instantclient,/usr/lib/Oracle/11.2/client/lib
# Vi/etc/PHP. d/oci8.ini
; Enable oci8 extension module
Extension = oci8.so
# Service httpd restart
1.1.26. Install Perl Components
1) run the following command with the root user:
Yum-y install Perl-geo-IP
1.1.27. Install zendoptimizer
Decompress the binary file of zendoptimizer and run install. Sh as the root user.
Tar zxvf./ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz
Sh./install. Sh
1.1.28. Install cronolog
Run the following command with the root user in the extracted cronolog source code directory:
./Configure; Make; make install
1.1.29. Install JDK
First, delete the original Java
Rm/usr/bin/Java
Rm/etc/alternatives/Java
Add the running permission to the JDK binary file, and then run
Chmoda + X./jdk-6u7-linux-i586-rpm.bin
/Jdk-6u7-linux-i586-rpm.bin
1.1.30. Install Oracle 10g for Linux x86_64
Refer:
Http://www.52zhe.cn/read.php/132.htm
Required software and documentation:
1: Document
Http://www.oracle.com/pls/db102/homepage
2: Software
Http://www.oracle.com/technology/software/products/database/index.html
Filename: 10201_database_linux_x86_64.cpio.gz
Preparations for the pre-Installation of part I Oracle
After the system is complete, check the required RPM package. For more information about the required software packages (URL), see the Oracle documentation ). This is the most important reference document. Finally, we can find all these packages based on the document. It is really not easy. This is always missing in the past.
[Root @ Minot ~] # Rpm-Q binutils compat-gcc-34 compat-gcc-34-c ++ compat-libstdc ++-33 control-center GCC gcc-C ++ gdbm glibc-common glibc-devel libgcc libgnome libstdc ++-devel libxp make sysstat util-Linux
[Root @ Minot ~] # Yum install compat-gcc-34 compat-gcc-34-c ++ compat-libstdc ++-33 GCC gcc-C ++ glibc-devel libstdc ++-devel sysstat libxp
Insert a few words: When you find any prompts, such as missing this library or that library. You can use the following Yum command example to query which RPM package this library belongs to. The RPM command can only query installed. (Rpm-QF)
[Root @ Minot ~] # Yum whatprovides library name
The following files, such as kernel parameters, ensure that the pre-Installation of Oracle is successful. Run the following command:
Add the following content at the end of line VI/etc/sysctl. conf:
#20071212 add content for Oracle install
Kernel. Shmall = 2097152
Kernel. shmmax = 2147483648
Kernel. shmmni = 4096
# Semaphores: semmsl, semmns, semopm, semmni
Kernel. SEM = 250 32000 100 128
FS. File-max = 65536
Net. ipv4.ip _ local_port_range = 1024 65000
Net. Core. rmem_default = 262144
Net. Core. rmem_max = 262144
Net. Core. wmem_default = 262144
Net. Core. wmem_max = 262144
Run the following command. Import the parameters just written. If this parameter is not executed, an alert is reported for Oracle detection before installation.
Sysctl-P
Add the following content at the end of line VI/etc/security/limits. conf:
#20071212 add content for Oracle install
* Soft nproc 2047
* Hard nproc 16384
* Soft nofile 1024
* Hard nofile 65536
Add the following content at the end of the line VI/etc/PAM. d/login:
#20071212 add content for Oracle install
Session required pam_limits.so
VI/etc/SELinux/config ensure the following content
SELinux = disabled
Click here to confirm.
Part II install oracle as an oracle user
Create oracle users and some installation directories.
Groupadd DBA
Groupadd oinstall
Useradd-G oinstall-g dba-M Oracle
Passwd Oracle
Mkdir-P/opt/Oracle
Chown-r oracle. oinstall/opt/Oracle
Place the Oracle Installation File in the home directory and decompress it.
Gzip-DC 10201_database_linux_x86_64.cpio.gz | cpio-Div
Add environment variables and define Sid.
Su-Oracle
Vi. bash_profile
#--------------------------------------
# Set for Oracle10g install;
#--------------------------------------
Trap "" 0 1 2 3 5 9 15
Trap clear 0
Export TMP =/tmp
Export tmpdir = $ TMP
Export oracle_base =/opt/Oracle
Export ORACLE_HOME = $ oracle_base/product/10.2.0/db_1
Export oracle_sid = orcl
Export oracle_term = xterm
Export Path =/usr/sbin: $ path
Export Path = $ ORACLE_HOME/bin: $ path
# Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ ORACLE_HOME/lib:/usr/local/lib
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/x11r6/lib64/
Export classpath = $ ORACLE_HOME/JRE: $ ORACLE_HOME/jlib: $ ORACLE_HOME/rdbms/jlib
Export ld_assume_kernel = 2.6.18
Export nls_lang = "simplified chinese_china". utf8
Lc_ctype = zh_cn.utf8
Lc_all = zh_cn.utf8
Lang = zh_cn.utf8
Umask 022
#
Reference environment variables
Source ~ /. Bash_profile
Install runinstall and dbca.
Note the following options during graph installation:/runinstall: select Advanced installation.
The language options are simplified Chinese and Traditional Chinese. Select to only install the database, and then use dbca to create a database.
1 Archive 2: All utf8 Chinese language 3: Activate Scott after installation for testing
Note: There is no problem with the installation of the Chinese utf8 environment. The graphic interface is displayed. It is not described in detail here.
~ /Database/runinstaller
Dbca
After Part III is installed, adjust dbstart and add the self-starting script.
An error is reported when $ ORACLE_HOME/bin/dbstart is run,
Failed to auto-start Oracle Net listene using/Ade/vikrkuma_new/Oracle/bin/tnslsnr
Solution: Modify the dbstart file and find oracle_home_listner =/Ade/vikrkuma_new/oracle.
Su-Oracle
VI 'which dbstart'
Oracle_home_listner = $ ORACLE_HOME
Modify the/etc/oratab File
Minot:/datas/apps/Oracle/product/10.2.0/db_1: Y
Create a self-starting script.
Explain the following line in the script: # chkconfig: 2345 80 05
The three groups of numbers indicate "Startup Mode", "startup sequence", and "close sequence"
Oracle 10g has started LSNRCTL in its own dbstart, so the following script commented out the LSNRCTL startup.
Touch dbora
Chmod 700 dbora
VI dbora
#! /Bin/bash
#
# Chkconfig: 2345 80 05
# Description: Oracle 10g Server
#/Etc/init. d/dbora
#
# Run-level STARTUP script for the Oracle instance, listener, and
# Web Interface
Export oracle_base =/opt/Oracle
Export ORACLE_HOME = $ oracle_base/product/10.2.0/db_1
Export oracle_sid = orcl
Export Path = $ path: $ ORACLE_HOME/bin
Ora_ownr = "oracle"
# If the executables do not exist -- Display Error
If [! -F $ ORACLE_HOME/bin/dbstart-o! -D $ ORACLE_HOME]
Then
Echo "Oracle startup: cannot start"
Exit 1
Fi
# Depending on Parameter -- startup, shutdown, restart
# Of the instance and listener or usage display
Case "$1" in
Start)
# Oracle listener and instance startup
Echo-n "Starting ORACLE :"
# Su $ ora_ownr-c "$ ORACLE_HOME/bin/LSNRCTL start"
Su $ ora_ownr-C $ ORACLE_HOME/bin/dbstart
Touch/var/lock/Oracle
Su $ ora_ownr-c "$ ORACLE_HOME/bin/emctl start dbconsole"
Su $ ora_ownr-c "$ ORACLE_HOME/bin/isqlplusctl start"
Echo "OK"
;;
Stop)
# Oracle listener and instance Shutdown
Echo-n "shutdown ORACLE :"
# Su $ ora_ownr-c "$ ORACLE_HOME/bin/LSNRCTL stop"
Su $ ora_ownr-C $ ORACLE_HOME/bin/dbshut
Rm-F/var/lock/Oracle
Su $ ora_ownr-c "$ ORACLE_HOME/bin/emctl stop dbconsole"
Su $ ora_ownr-c "$ ORACLE_HOME/bin/isqlplusctl stop"
Echo "OK"
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo "Usage: 'basename $ 0' START | stop | restart | reload"
Exit 1
Esac
Exit 0
CP dbora/etc/rc. d/init. d
Chkconfig -- add dbora
Chkconfig -- list | grep dbora
Dbora 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable
Part IV introduction and supplement of some services
Main service start Modes
A: $ ORACLE_HOME/bin/dbstart | dbshut
B: $ ORACLE_HOME/bin/LSNRCTL START | stop listener START | close.
C: $ ORACLE_HOME/bin/emctl START | stop dbconsole
Access http: // yourip: 1158/em
D: $ ORACLE_HOME/bin/isqlplusctl START | stop
Access http: // yourip: 5560/isqlplus
2. Account Management
Create a separate account for each user who needs to log on to the server and grant the account group permissions to the user. For example, if you need to develop a web program, grant the Apache Group Permissions. Everyone must use their own account to log on to the server. If the root account is required, log on with the Development Account and use the su command to convert it to the root user:
Su-Root
The root account does not support remote logon.
The user permission for Apache Runtime is Apache
3. Database Management
Each business connects to the database using an independent user. The business cannot use root to connect to the database.
4 Server Directory management 4.1 installation directory of Common Software
All programs, documents, and other content to be maintained are stored in the following directory:
/Var/WWW
Create the following sub-directories in this directory:
SRC --- program source code
Cron --- crontab Program
Proc --- processes running by the System
Upload --- upload content
Cgi-bin --- CGI program
Htdocs --- directory pointed to during access with an IP address
Www.domain.com --- the directory to which the domain name directs
Log-logs recorded by the program running
Dump --- database dump content
Resource --- resource file
Cache --- temporary Cache
Test --- program used for testing
Temp --- directory of temporary files
Backup --- directory used for backup
4.2 log format
File Name format
The log content can be in two formats: separated by commas (,) or fixed length. Each log directory must have a ReadMe file (UTF-8 encoding) describing the log format.
5. server data migration
• Use the mysqldump program to export useful tables in the MySQL database
• Back up httpd. conf of Apache
• Backup/svnroot
• Backup crontab
• Backup/etc/rc. d/rc. Local
• Backup network configuration