搬服务器全过程

1.从A服务器打包

tar -zcvf /usr/back/app.tar.gz /www/web/app

2.移动
scp /usr/back/app.tar.gz [email protected]:/www/web
3.解压
cd /www/web
tar -zxvf  app.tar.gz

4.打包的时候把html的目录几个目录去除
tar -czvf html.tar.gz html/ --exclude="html/trunk/compressfile/*" --exclude="html/trunk/compresspdf/*"

5.scp html.tar.gz [email protected]:/www/web

6.tar -zxvf html.tar.gz

重启apache出现以下错误:
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz

#tar -zxvf cronolog-1.6.2.tar.gz
  #cd cronolog-1.6.2
  #./configure
  #make && make install
7.打包数据库
8.安装memcached
cd ~

curl -O http://www.monkey.org/~provos/libevent-2.0.13-stable.tar.gz

tar -zxvf libevent-2.0.13-stable.tar.gz

cd libevent-2.0.13-stable-tar.gz

./configure --prefix=/usr

make ; make install

tar -zxvf memcached-1.4.0.tar.gzcd memcached-1.4.0.tar.gz
./configure --with-libevent=/usr
make ; make install
http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
tar zxvf memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure --with-libevent=/usr
make && make install

启动memcache的时候出现类似错误

/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

由于编译程序的时候libevent路径错误造成的。可以使用以下方法解决

我按别人的攻略安装了libevent和memcached之后却发现在执行的时候出现了。 error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory 这个错误提示。

解决类似问题的步骤我相信我的做法可以通用。

1. 首先 find / -name libevent-1.4.so.2 找到缺少的链接文件到底在那儿。

2. LD_DEBUG=libs /usr/local/bin/memcached -v

3. 从Debug信息中就知道程序去哪里找链接库了。我这边程序去 trying file=/usr/lib/libevent-1.4.so.2 而我的链接库的实际存储位置是 /usr/local/lib/libevent-1.4.so.2

4. 做一个软连接 ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib/libevent-1.4.so.2

5. 搞定。

8.php memcache 支持
01.wget http://pecl.php.net/get/memcache-2.1.2.tgz 
02. 
03.tar -xvf memcache-2.1.2.tgz 
04. 
05.cd memcache-2.1.2 
06. 
/www/server/php/bin/phpize && ./configure --enable-memcache && make

出现如下错误:
memcache.c:xxx: error: too few arguments to function 'zend_list_insert'

解决办法:
将所有的:

zend_list_insert(pool, le_memcache_pool TSRMLS_CC);
改为:

zend_list_insert(pool, le_memcache_pool);

9.安装startling
yum install ruby ruby-devel rubygems
gem install memcache-client starling

10.安装sendmail
  cd /etc/mail
cd: /etc/mail: No such file or directory
那就先安装
yum install sendmail

修改sendmail配置
vi /etc/mail/sendmail.mc
把最前面的dnl删除,变成:
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS',`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
修改SMTP的监听IP为 0.0.0.0
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
生成配置
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
***************************
如果出现:sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory
说明需要安装sendmail-cf
yum install sendmail-cf
修改dovecot配置
yum -y install dovecot 

vi /etc/dovecot.conf
去掉下面一行前面的#
#protocols =imap imaps pop3 pop3s
添加域名
vi /etc/mail/local-host-names
添加域名如:mydomain.com //每个域名一行
修改认证方式
vi /etc/sysconfig/saslauthd 找到第7行的:MECH=pam 改成:MECH=shadow
启动服务
service saslauthd start       #启动saslauthd
chkconfig saslauthd on      #设置saslauthd开机自动启动
测试服务
testsaslauthd -u username -p password
如果显示0: OK “Success.”则表明saslauthd工作正常;
启动dovecot;
service dovecot start
chkconfig dovecot on
outlook配置
需要勾选服务器验证,否则会出现收件人拒收的错误,类似 Relaying denied. IP name lookup failed

新增邮件用户
[root@localhost ~]# groupadd mailuser
[root@localhost ~]# adduser -g mailuser -s /sbin/nologin test
[root@localhost ~]# passwd test

重启完毕后可以发邮件了,但速度之慢,令人发指,此时可以输入如下命令查看一下解析文件:cat /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
199.193.248.26           weimtv

因为sendmail监听的是127.0.0.1,但却无法确认主机名weimtv (因为在服务器上/etc/sysconfig/network文件里记录的HOSTNAME是weimtv),所以发送邮件就非常慢了。那么我就把weimtv这个主机名同时也加到127.0.0.1上面,变成:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost weimtv
199.193.248.26           weimtv

重启 service sendmail restart
如出现如下错误:
tarting sendmail: 554 5.0.0 /etc/mail/sendmail.cf: line 39: unknown configuration line "
则表示39行有空格,vi 后 :set nu进去 39行删除掉就可以了

测试sendmail
mail -s "test" [email protected] < /tmp/test.log
-s后面是主题然后是邮箱最后是你要发送的文本内容
-bash: mail: command not found
显然mailx没有安装,于是:
yum -y install mailx



猜你喜欢

转载自leeyin.iteye.com/blog/1825155