服务器环境安装笔记

一、安装java
yum -y install java

二、安装apache
yum -y install httpd

配置apache目录
vi /etc/httpd/conf/httpd.conf

在DocumentRoot "xxx/"中的""将写入你的目录

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/home/tomcat/">

在<Directory "/home/tomcat/">的引号中写入你的目录

启动apache
service httpd start

关闭apache
service httpd stop

三、源码安装mysql5.1.36
1.下载5.1.36源码
wget -c http://61.129.115.192/mysql-5.1.36.tar.gz
2.安装mysql必须的包 gcc gxx make
yum -y install gcc-c++ libstdc++-devel make
3.创建第二块盘符存放mysql的数据库

查看磁盘情况
# fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 38913 312464250 8e Linux LVM

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2550 20482843+ 7 HPFS/NTFS
/dev/sdb2 2551 38913 292085797+ 7 HPFS/NTFS


在sdb上创建新的文件系统
mkfs -t ext3 /dev/sdb

创建新的目录用于挂载
mkdir /mysql

挂载目录
mount /dev/sdb /mysql


4.安装mysql
cd /home/tomcat/ (此为mysql源码包存放位置)
tar -zxvf mysql-5.1.36.tar.gz
cd mysql-5.1.36
配置mysql安装环境
./configure -prefix=/opt/mysql5.1 -localstatedir=/mysql \
-sysconfdir=/opt/mysql5.1 -without-debug \
-with-unix-socket-path=/opt/mysql5.1/mysql.sock -with-big-tables\
-with-charset=gbk -with-collation=gbk_chinese_ci -enable-assembler \
-with-extra-charsets=gbk,gb2312,utf8 -with-pthread -enable-thread-safe-client \
-with-innodb -disable-safe-thread

如果发生以下错误:
error: No curses/termcap library found
说明mysql没有找到ncurses的系统程序,只要yum -y install ncurses-devel即可

make
make install

配置mysql
cd /opt/mysql5.1

设置目录权限
chmod 755 -R /opt/mysql5.1/
chown mysql.mysql -R /opt/mysql5.1/
chmod 755 -R /mysql/
chown mysql.mysql -R /mysql/
配置mysql为系统服务
cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chkconfig mysqld

配置mysql
cp share/mysql/my-huge.cnf /etc/my.cnf
vi /etc/my.cnf

设置系统默认编码为utf-8
在mysqld和mysql下加入
default-character-set = utf8

初始化mysql
bin/mysql_install_db -umysql &

启动mysql
bin/mysqld_safe &

如果bin/mysql 可以启动 说明安装完成

将mysql设为系统命令
ln -s /opt/mysql5.1/bin/mysql /usr/bin/mysql

启动mysqld
service mysqld start

关闭mysqld
service mysqld stop

四、安装phpyum -y install php php-mysql php-mbstring

五、安装tomcat
wget -c ftp://www:tsl600tsl600@114.80.100.163/apache-tomcat-6.0.20.tar.gz

tar -zxvf apache-tomcat-6.0.20.tar.gz
mv apache-tomcat-6.0.20 tomcat6
mv tomcat6 /opt/

配置tomcat
vi /opt/tomcat6/conf/server.xml


<!--
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
中的<!-- -->注释符号去掉
启动tomcat
/opt/tomcat6/bin/startup.sh

如果启动没成功,可以通过setup中的 Firewall configuration 将服务器的防火强和selinux关闭然后再启动

关闭tomcat
/opt/tomcat6/bin/shutdown.sh

linux ftp配置
(1)安装ftp服务 yum install vsftpd
(2)更新配置文件,cd /etc/vsftpd,删除原先的vsftpd.conf,再从其他服务器拷贝配置文件 wget http://61.129.115.192/vsftpd.conf
(3)关闭防火墙,service iptables stop
(4)关闭selinux,setenforce 0
(5)开启 service vsftpd start

mysql添加本地用户以及远程用户
GRANT ALL PRIVILEGES ON *.* TO [email=spiderman@]spiderman@'%'[/email] IDENTIFIED BY '2008rain' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO [email=spiderman@]spiderman@'localhost'[/email] IDENTIFIED BY '2008rain' WITH GRANT OPTION;

六、安装sphinx
wget -c ftp://www:tsl600tsl600@114.80.100.163/csft-3.1.tar.gz
wget -c ftp://www:tsl600tsl600@114.80.100.163/mmseg-3.1.tar.gz

安装mmseg
tar -zxvf mmseg-3.1.tar.gz
cd mmseg-3.1
./configure –prefix=/opt/mmseg
make
make install

安装mmseg完成,测试一下

mmseg
Coreseek COS(tm) MM Segment 1.0
Copyright By Coreseek.com All Right Reserved.
Usage: mmseg <option> <file>
-u <unidict> Unigram Dictionary
-r Combine with -u, used a plain text build Unigram Dictionary, default Off
-b <Synonyms> Synonyms Dictionary
-h print this help and exit
有问题可以尝试执行下面命令

echo ‘/opt/mmseg/lib’ >> /etc/ld.so.conf
ldconfig -v
ln -s /opt/mmseg/bin/mmseg /bin/mmseg

安装sphinx
tar -zxvf csft-3.1.tar.gz
cd csft-3.1

配置安装信息
./configure -prefix=/opt/csft -with-mysql=/opt/mysql5.1/ -with-mysql-includes=/opt/mysql5.1/include/mysql -with-mysql-libs=/opt/mysql5.1/lib/mysql -with-mmseg=/opt/mmseg/ -with-mmseg-includes=/opt/mmseg/include/mmseg -with-mmseg-libs=/opt/mmseg/lib
make && make install

生成词典
进入到mmseg的源代码目录后

cd data
mmseg -u unigram.txt
在data下边会产生一个文件unigram.txt.uni
这个就是生成的字典 然后把字典改名为uni.lib放在可以读取的目录中即可

cp unigram.txt.uni /opt/csft/uni.lib

七、配置sphinx在sphinx.conf中加入以下配置:
source topic
{
type = mysql
sql_host = localhost
sql_user = sphinx
sql_pass = tsl600
sql_db = spidertitle
sql_port = 3306 # optionalm default is 3306
sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type = OFF
sql_query_pre = REPLACE into topic_count select 1,MAX(id) from topic
sql_query = select id,title,visit,reply,score,UNIX_TIMESTAMP(adddate) as topicdate,UNIX_TIMESTAMP(lastupdate) as spiderdate from topic where lastupdate>=(NOW()- interval 3 month) and id<=(select max_topicid from topic_count where counter_id=1)
sql_attr_uint = id
sql_attr_uint = reply
sql_attr_uint = visit
sql_attr_uint = score
sql_attr_timestamp = topicdate
sql_attr_timestamp = spiderdate

}

source topicthrottled : topic
{
sql_ranged_throttle = 100
sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query = select id,title,visit,reply,score,UNIX_TIMESTAMP(adddate) as topicdate,UNIX_TIMESTAMP(lastupdate) as spiderdate from topic\
where id>(select max_doc_id from topic_count where counter_id=1)
}

index topicmain
{
source = topic
path = /opt/csft/var/data/topicmain
docinfo= extern
mlock = 0
charset_type = zh_cn.utf-8
charset_dictpath = /opt/csft/
}
index topicdelta:topicmain
{
source = topicthrottled
path = /opt/csft/var/data/topicdelta
docinfo= extern
mlock = 0
charset_type = zh_cn.utf-8
charset_dictpath = /opt/csft
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值