服务器环境安装笔记

一、安装java

yum-yinstalljava

二、安装apache

yum-yinstallhttpd

配置apache目录

vi/etc/httpd/conf/httpd.conf

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

#

#ThisshouldbechangedtowhateveryousetDocumentRootto.

#

<Directory"/home/tomcat/">

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

启动apache

servicehttpdstart

关闭apache

servicehttpdstop

三、源码安装mysql5.1.36

1.下载5.1.36源码

wget-chttp://61.129.115.192/mysql-5.1.36.tar.gz

2.安装mysql必须的包gccgxxmake

yum-yinstallgcc-c++libstdc++-develmake

3.创建第二块盘符存放mysql的数据库

查看磁盘情况

[[email protected]]#fdisk-l

Disk/dev/sda:320.0GB,320072933376bytes

255heads,63sectors/track,38913cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

/dev/sda1*11310439183Linux

/dev/sda214389133124642508eLinuxLVM

Disk/dev/sdb:320.0GB,320072933376bytes

255heads,63sectors/track,38913cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

/dev/sdb1*1255020482843+7HPFS/NTFS

/dev/sdb2255138913292085797+7HPFS/NTFS

在sdb上创建新的文件系统

mkfs-text3/dev/sdb

创建新的目录用于挂载

mkdir/mysql

挂载目录

mount/dev/sdb/mysql

4.安装mysql

cd/home/tomcat/(此为mysql源码包存放位置)

tar-zxvfmysql-5.1.36.tar.gz

cdmysql-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:Nocurses/termcaplibraryfound

说明mysql没有找到ncurses的系统程序,只要yum-yinstallncurses-devel即可

make

makeinstall

配置mysql

cd/opt/mysql5.1

设置目录权限

chmod755-R/opt/mysql5.1/

chownmysql.mysql-R/opt/mysql5.1/

chmod755-R/mysql/

chownmysql.mysql-R/mysql/

配置mysql为系统服务

cpshare/mysql/mysql.server/etc/rc.d/init.d/mysqld

chkconfigmysqld

配置mysql

cpshare/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

servicemysqldstart

关闭mysqld

servicemysqldstop

四、安装phpyum-yinstallphpphp-mysqlphp-mbstring

五、安装tomcat

wget-cftp://www:[email protected]/apache-tomcat-6.0.20.tar.gz

tar-zxvfapache-tomcat-6.0.20.tar.gz

mvapache-tomcat-6.0.20tomcat6

mvtomcat6/opt/

配置tomcat

vi/opt/tomcat6/conf/server.xml

<!--

<Connectorport="8080"protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443"/>

-->

中的<!---->注释符号去掉

启动tomcat

/opt/tomcat6/bin/startup.sh

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

关闭tomcat

/opt/tomcat6/bin/shutdown.sh

linuxftp配置

(1)安装ftp服务yuminstallvsftpd

(2)更新配置文件,cd/etc/vsftpd,删除原先的vsftpd.conf,再从其他服务器拷贝配置文件wgethttp://61.129.115.192/vsftpd.conf

(3)关闭防火墙,serviceiptablesstop

(4)关闭selinux,setenforce0

(5)开启servicevsftpdstart

mysql添加本地用户以及远程用户

GRANTALLPRIVILEGESON*.*TO[email=spiderman@]spiderman@'%'[/email]IDENTIFIEDBY'2008rain'WITHGRANTOPTION;

GRANTALLPRIVILEGESON*.*TO[email=spiderman@]spiderman@'localhost'[/email]IDENTIFIEDBY'2008rain'WITHGRANTOPTION;

六、安装sphinx

wget-cftp://www:[email protected]/csft-3.1.tar.gz

wget-cftp://www:[email protected]/mmseg-3.1.tar.gz

安装mmseg

tar-zxvfmmseg-3.1.tar.gz

cdmmseg-3.1

./configure–prefix=/opt/mmseg

make

makeinstall

安装mmseg完成,测试一下

mmseg

CoreseekCOS(tm)MMSegment1.0

CopyrightByCoreseek.comAllRightReserved.

Usage:mmseg<option><file>

-u<unidict>UnigramDictionary

-rCombinewith-u,usedaplaintextbuildUnigramDictionary,defaultOff

-b<Synonyms>SynonymsDictionary

-hprintthishelpandexit

有问题可以尝试执行下面命令

echo‘/opt/mmseg/lib’>>/etc/ld.so.conf

ldconfig-v

ln-s/opt/mmseg/bin/mmseg/bin/mmseg

安装sphinx

tar-zxvfcsft-3.1.tar.gz

cdcsft-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&&makeinstall

生成词典

进入到mmseg的源代码目录后

cddata

mmseg-uunigram.txt

在data下边会产生一个文件unigram.txt.uni

这个就是生成的字典然后把字典改名为uni.lib放在可以读取的目录中即可

cpunigram.txt.uni/opt/csft/uni.lib

七、配置sphinx在sphinx.conf中加入以下配置:

sourcetopic

{

type=mysql

sql_host=localhost

sql_user=sphinx

sql_pass=tsl600

sql_db=spidertitle

sql_port=3306#optionalmdefaultis3306

sql_query_pre=SETNAMESutf8

sql_query_pre=SETSESSIONquery_cache_type=OFF

sql_query_pre=REPLACEintotopic_countselect1,MAX(id)fromtopic

sql_query=selectid,title,visit,reply,score,UNIX_TIMESTAMP(adddate)astopicdate,UNIX_TIMESTAMP(lastupdate)asspiderdatefromtopicwherelastupdate>=(NOW()-interval3month)andid<=(selectmax_topicidfromtopic_countwherecounter_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

}

sourcetopicthrottled:topic

{

sql_ranged_throttle=100

sql_query_pre=SETNAMESutf8

sql_query_pre=SETSESSIONquery_cache_type=OFF

sql_query=selectid,title,visit,reply,score,UNIX_TIMESTAMP(adddate)astopicdate,UNIX_TIMESTAMP(lastupdate)asspiderdatefromtopic\

whereid>(selectmax_doc_idfromtopic_countwherecounter_id=1)

}

indextopicmain

{

source=topic

path=/opt/csft/var/data/topicmain

docinfo=extern

mlock=0

charset_type=zh_cn.utf-8

charset_dictpath=/opt/csft/

}

indextopicdelta:topicmain

{

source=topicthrottled

path=/opt/csft/var/data/topicdelta

docinfo=extern

mlock=0

charset_type=zh_cn.utf-8

charset_dictpath=/opt/csft

}

相关推荐