从头到脚编译安装VPS上所有东西 

拜Trafficserver 所赐,把我的VPS上所有的数据都搞没了~使用开源软件的潜在风险还得自己担着~ 我也只好是只认倒霉了~谁让使用MySQL养成的臭习惯呢~

具体见:http://www.mail-archive.com/[email protected]/msg00875.html (需翻墙)

总之,我之后便一狠心删除掉了VPS上的所有数据,就差重装系统了~现如今,我的数据也就那样了,我便打算重新架起VPS。

下载所有需要软件的源码包~如PHP、MySQL之类的.

wget http://mysql.mirrors.hoobly.com/Downloa ... -m5.tar.gz
wget http://nginx.org/download/nginx-1.0.4.tar.gz
wget http://downloads.php.net/stas/php-5.4.0alpha1.tar.bz2
wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.4.tar.gz
wget http://www.hiawatha-webserver.org/files ... 7.5.tar.gz
wget http://repo.varnish-cache.org/source/va ... 0.0.tar.gz
wget http://prdownloads.sourceforge.net/pam- ... RC1.tar.gz

全部解压,ls一下,

drwxr-xr-x 3 root root 4096 Jul 3 06:31 config_bak
drwxrwxrwx 7 1000 users 4096 Jun 6 01:06 hiawatha-7.5
drwxr-xr-x 31 7161 wheel 4096 Mar 14 16:40 mysql-5.6.2-m5
drwxr-xr-x 8 http games 4096 Jun 1 13:30 nginx-1.0.4
drwxrwxrwx 2 1000 1000 4096 Jan 9 2006 pam_mysql-0.7RC1
drwxr-xr-x 14 http games 4096 Jun 20 00:24 php-5.4.0alpha1
drwxr-xr-x 10 1000 1000 4096 Jun 16 15:38 varnish-3.0.0
drwxr-x--x 8 1000 1000 4096 Jun 30 18:15 vsftpd-2.3.4

一个个来吧~

先MySQL,进入目录:
首先 cmake . -LAH 查看编译帮助,我的编译参数:

[root@PowerPC mysql-5.6.2-m5]# cmake . \
> -DCMAKE_BUILD_TYPE:STRING=Release \
> -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \
> -DCOMMUNITY_BUILD:BOOL=ON \
> -DINSTALL_BINDIR:STRING=../bin \
> -DINSTALL_LAYOUT:STRING=STANDALONE \
> -DINSTALL_SBINDIR:STRING=../sbin \
> -DMYSQL_DATADIR:PATH=/var/mysql/data \
> -DSYSCONFDIR:PATH=/etc/sysconfig/mysql \
> -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_EXTRA_CHARSETS:STRING=all \
> -DWITH_FEDERATED_STORAGE_ENGINE:BOOL=ON \
> -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
> -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
> -DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
> -DWITH_SSL:STRING=no \
> -DWITH_ZLIB:STRING=bundled

依赖没有问题,开始编译,之后安装.再把之前的配置文件my.cnf 恢复下。

进入 /usr/local/mysql 目录,创建软连接至 /usr/local/bin:
ln -s ../bin bin

再把sbin 下的mysqld 复制到 bin 下:
cp mysqld ../bin

这么做,是为了方便初始化数据库,运行位于scripts 下的mysql_install_db 脚本:
./mysql_install_db --datadir=/var/mysql --user=mysql --basedir=/usr/local/mysql

数据库初始化完了之后,就可以启动MySQL服务了~
mysqld_safe &

最好在运行下 mysql_secure_installation ,设置下root 密码,以及删除测试表.

不过,我发现test 表并没有被删掉,phpmyadmin 提示"can't rmdir './test/', errno: 17"错误。排除了权限问题,我发现原来test 目录下并不是空的,而是有一个".empty"的文件,手动删除(rm -rf test)即可~

接下来PHP,进入目录:
我的configure:
[root@PowerPC php-5.4.0alpha1]# ./configure \
> --prefix=/usr/local/php \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/php \
> --localstatedir=/var \
> --disable-cli \
> --enable-fpm \
> --with-fpm-user=http \
> --with-fpm-group=web \
> --with-config-file-path=/etc/sysconfig/php/php.ini \
> --with-config-file-scan-dir=/etc/sysconfig/php \
> --disable-ipv6 \
> --enable-calendar \
> --enable-dba=shared \
> --enable-exif \
> --with-gd \
> --enable-gd-native-ttf \
> --with-mhash \
> --enable-mbstring \
> --with-mcrypt \
> --with-mysql=/usr/local/mysql \
> --with-mysql-sock=/tmp/mysql.sock \
> --with-mysqli=/usr/local/bin/mysql_config \
> --disable-pdo \
> --enable-sockets \
> --with-xmlrpc \
> --enable-zip \
> --with-zlib \
> --with-bz2 \
> --without-pear

依赖没问题,直接make 编译,之后make install 安装,最后恢复下备份的配置文件。

再然后是Web server,首先是nginx,进入目录:
我的configure:
[root@PowerPC nginx-1.0.4]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/var/run/nginx.lock \
> --user=http \
> --group=web \
> --with-select_module \
> --with-poll_module \
> --with-http_image_filter_module \
> --with-http_sub_module \
> --with-http_dav_module \
> --with-http_flv_module \
> --with-http_gzip_static_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx \
> --http-proxy-temp-path=/tmp/nginx \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

检查依赖,报错:

./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.


解决方案:yum install gd-devel
再次检查,通过。
编译概况为:

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx"
nginx http proxy temporary files: "/tmp/nginx"


make && make install 开始编译安装。之后恢复下之前的配置文件。
nginx -t 测试下配置文件,报错:

nginx: [emerg] the default path name "/tmp/nginx" has the same name as another default path, but the different levels, you need to redefine one of them in http section


看来缓存路径不能设成一样的,如果不像重新编译,就在配置文件里重写。
在nginx.conf 的http 块里加入
client_body_temp_path /tmp/nginx/request/;
一行即可。

之后就是hiawatha了,同样是7.5的版本,我之前编译过一次。不赘述了~
我的configure:
[root@PowerPC hiawatha-7.5]# ./configure \
> --prefix=/usr/local/hiawatha \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/hiawatha \
> --localstatedir=/var \
> --disable-largefile \
> --enable-chroot \
> --enable-command \
> --disable-ipv6 \
> --disable-monitor \
> --disable-ssl

然后就是缓存服务器Varnish,进入目录:
我的configure:
[root@PowerPC varnish-3.0.0]# ./configure \
> --prefix=/usr/local/varnish \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/varnish \
> --localstatedir=/var \
> --disable-largefile \
> --with-pcre-config=/usr/bin/pcre-config \
> --with-jemalloc

检查依赖,没有问题。make 编译,之后make install 安装。
最后在恢复下以前的配置文件,不过值得注意的是适用于2.1.x的配置格式可能与3.0.0有些出入,如引入了字符串 "+" 连接功能。

本来想,随便把vsftpd搞好,随便把pam_mysql 验证也搞定的~不过vsftpd 在编译的时候报错~这真的是很奇怪~

[root@PowerPC vsftpd-2.3.4]# make
gcc -o vsftpd main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o tunables.o ftpdataio.o secbuf.o ls.o postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o banner.o filestr.o parseconf.o secutil.o ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o tcpwrap.o ipaddrparse.o access.o features.o readwrite.o opts.o ssl.o sslslave.o ptracesandbox.o ftppolicy.o sysutil.o sysdeputil.o -Wl,-s `./vsf_findlibs.sh`
sysutil.o: In function `vsf_sysutil_open_file':
sysutil.c:(.text+0x1626): undefined reference to `__open64_2'
collect2: ld returned 1 exit status
make: *** [vsftpd] Error 1


可能我要发邮件问下开发者了~
[ ] ( 1903 次浏览 ) 永久链接 ( 3 / 2250 )

<< <上一页 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 下一页> >>