网络安全 频道

架设某大型网站服务器之全过程

注意:如果启动不理想,请编写shell scripts:
方法:以我个人习惯为例;;;;;;;;;;
#mkdir /usr/local/syscmf

#vi /usr/local/syscmf/oracle.sh
////////////////////////文件内容开始///////////////////

#!/bin/sh
#modify by mingfu 060404
#oracle run scripts
#run user for oracle
lsnrctl start
expect /usr/local/syscmf/oracle.exp

////////////////////////文件内容结束///////////////////
#vi /usr/local/syscmf/oracle.exp
////////////////////////文件内容开始///////////////////
#!/usr/local/bin/expect
#modify by mingfu 060404
#oracle run scripts
set timeout 120
spawn sqlplus //nolog
expect "SQL/>"
send "conn // as sysdba/r"
expect "SQL/>"
send "startup/r"
expect "SQL/>"
send "exit/r"

exit
////////////////////////文件内容结束///////////////////
#chown oracle /usr/local/syscmf/*
#chgrp oracle /usr/local/syscmf./*
#chmod 755 /usr/local/syscmf/*

在/etc/rc.local中新增如下内容:
su – oracle /usr/local/syscmf/oracle.sh
删除原来的:
su - oracle -c "/opt/ora9/oracle/product/9.2.0.4/bin/lsnrctl start"
su - oracle -c "/opt/ora9/oracle/product/9.2.0.4/bin/dbstart start"

6, 关于数据库删除重新安装的问题:
把ORACLE安装目录删除及/etc/ora*.*删除就行了
#rm –f /etc/ora*.*

7,关于在LINUX中运行管理软件$oemapp
#su – oracle
$oemapp console

8, 中文显示不正常解决办法
Oracle 目前缺省安装的字符集是WE8MSWIN1252,不是中文字符集,并且不能通过直接运行 alter database character set ZHS16GBK ; 来修改,因为ZHS16GBK不是缺省字符集的超集。过去流传很广的直接修改sys用户下的PROPS$表的方法,也会给字符集的变更留下很多潜在的问题.

linux下进行如下的操作来修改字符集:
sqlplus /nolog

sql>conn / as sysdba

sql>shutdown immediate

sql>startup mount

sql>alter system enable restricted session ;

sql>alter system set JOB_QUEUE_PROCESSES=0;

sql>alter system set AQ_TM_PROCESSES=0;

sql>alter database open ;

sql>alter database character set internal_use ZHS16GBK ;

sql>shutdown immediate

sql>startup

这样字符集的修改就完成了(如果你在安装时选择了中文字符集,这里就不用修改了)

LAJO服务环境配置完毕.

5.配置LAMP
系统自带安装http+php+mysql软件包,进行配置如下:

Apache配置
修改/etc/httpd/conf/httpd.conf内容如下:
Listen 82
ServerName 127.0.0.1:82
DocumentRoot "/var/www/html"
<Directory "/var/www/html">

注意:系统已经有两个httpd服务进程.
用户分别是:xxxx apache
请确保
/usr/local/apache2/bin/apachectl start
/etc/init.d/httpd start
此两个服务自启动.

Mysql设置

Mysql>create ftpdb;

Mysql>grant all privileges on ftpdb.* to ftpuser@localhost identified by “xxxx”;

Mysql>grant all privileges on *.* to root@’%’ identified by “xxxx”;

Mysql>flush privileges;

Mysql>exit
请确保
/etc/init.d/mysqld start
此服务自启动.

LAMP服务环境配置完毕.

7.配置FTP
配合工程实施与建立ftp帐号相关联,方便维护与管理,我这里选择了Proftpd与数据库结合的方式来实现的.

创建Ftpdb结构:

Mysql>use ftpdb;

Mysql> CREATE TABLE `ftpgroup` (
`groupname` varchar(16) NOT NULL default ’’,
`gid` smallint(6) NOT NULL default ’5500’,
`members` varchar(16) NOT NULL default ’’,
KEY `groupname` (`groupname`)
) ;

Mysql> CREATE TABLE `ftpquotalimits` (
`name` varchar(30) default NULL,
`quota_type` enum(’user’,’group’,’class’,’all’) NOT NULL default ’user’,
`per_session` enum(’false’,’true’) NOT NULL default ’false’,
`limit_type` enum(’soft’,’hard’) NOT NULL default ’soft’,
`bytes_in_avail` float NOT NULL default ’0’,
`bytes_out_avail` float NOT NULL default ’0’,
`bytes_xfer_avail` float NOT NULL default ’0’,
`files_in_avail` int(10) unsigned NOT NULL default ’0’,
`files_out_avail` int(10) unsigned NOT NULL default ’0’,
`files_xfer_avail` int(10) unsigned NOT NULL default ’0’
) ;

Mysql> CREATE TABLE `ftpquotatallies` (
`name` varchar(30) NOT NULL default ’’,
`quota_type` enum(’user’,’group’,’class’,’all’) NOT NULL default ’user’,
`bytes_in_used` float NOT NULL default ’0’,
`bytes_out_used` float NOT NULL default ’0’,
`bytes_xfer_used` float NOT NULL default ’0’,
`files_in_used` int(10) unsigned NOT NULL default ’0’,
`files_out_used` int(10) unsigned NOT NULL default ’0’,
`files_xfer_used` int(10) unsigned NOT NULL default ’0’
) ;

Mysql> CREATE TABLE `ftpuser` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` varchar(32) NOT NULL default ’’,
`passwd` varchar(32) NOT NULL default ’’,
`uid` smallint(6) NOT NULL default ’5500’,
`gid` smallint(6) NOT NULL default ’5500’,
`homedir` varchar(255) NOT NULL default ’’,
`shell` varchar(16) NOT NULL default ’/sbin/nologin’,
`count` int(11) NOT NULL default ’0’,
`accessed` datetime NOT NULL default ’0000-00-00 00:00:00’,
`modified` datetime NOT NULL default ’0000-00-00 00:00:00’,
PRIMARY KEY (`id`)
) ;

Mysql> INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES("5dxc", "5500", "xxxx");

Mysql>INSERT INTO `ftpquotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES("test", "user", "false", "soft", "1.024e+06", "0", "0", "0", "0", "0");

Mysql> INSERT INTO `ftpquotatallies` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES("test", "user", "809781", "0", "809781", "0", "0", "0");

Mysql> INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`, `count`, `accessed`, `modified`) VALUES("1", "test", "test", "5500", "5500", "/site", "/sbin/nologin", "0", "0000-00-00 00:00:00", "0000-00-00 00:00:00");

配置proftp:
#tar xzvf proftpd-1.3.0rc5.tar.gz
#cd proftpd-1.3.0rc5
#./configure --prefix=/usr/local/proftpd --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql:mod_ratio --with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql

#make&&make install

#mv /etc/local/proftpd/etc/proftpd.conf /etc/local/proftpd/etc/proftpd.confbak

#vi /etc/local/proftpd/etc/proftpd.conf
////////////////////////文件内容///////////////////
# This is a basic ProFTPD configuration file (rename it to
# ’proftpd.conf’ for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

#ServerName "ProFTPD Default Installation"
ServerName "Mingfu’s ftp"
ServerType standalone
DefaultServer on

# Port 21 is the standard FTP port.
Port 21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 100
MaxLoginAttempts 3

# Set the user and group under which the server will run.
User nobody
Group nobody


0
相关文章