一.centos环境安装及上网配置
1、下载配置完整开源库的centos包。(楼主最开始下载的官网包,各种库安装下来快要哭了,最后只能放弃)
2、CentOS 修改DNS
修改对应网卡的DNS的配置文件
# vi /etc/resolv.conf
修改以下内容
nameserver 8.8.8.8 #google域名服务器
3、CentOS 修改网关
修改对应网卡的网关的配置文件
[root@centos]# vi /etc/sysconfig/network
NETWORKING=yes(表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络,而且很多系统服务程序将无法启动)
HOSTNAME=centos(设置本机的主机名,这里设置的主机名要和/etc/hosts中设置的主机名对应)
GATEWAY=192.168.1.1(设置本机连接的网关的IP地址。例如,网关为10.0.0.2)
4、CentOS 修改IP地址
修改对应网卡的IP地址的配置文件
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
修改以下内容
DEVICE=eth0 #描述网卡对应的设备别名,例如ifcfg-eth0的文件中它为eth0
BOOTPROTO=static #设置网卡获得ip地址的方式,可能的选项为static,dhcp或bootp,分别对应静态指定的 ip地址,通过dhcp协议获得的ip地 址,通过bootp协议获得的ip地址
BROADCAST=192.168.0.255 #对应的子网广播地址
HWADDR=00:07:E9:05:E8:B4 #对应的网卡物理地址
IPADDR=12.168.1.2 #如果设置网卡获得 ip地址的方式为静态指定,此字段就指定了网卡对应的ip地址
IPV6INIT=no
IPV6_AUTOCONF=no
NETMASK=255.255.255.0 #网卡对应的网络掩码
NETWORK=192.168.1.0 #网卡对应的网络地址
ONBOOT=yes #系统启动时是否设置此网络接口,设置为yes时,系统启动时激活此设备
5、重新启动网络配置
# service network restart
或
# /etc/init.d/network restart
楼主刚开始只是通过 ifconfig ens33 192.168.xx.xx up
route add default gw 192.168.22.1
nameserver 192.168.xx.xx
设置IP 网管和 DNS,结果重启后就失效了,所以,只能通过以上方法又重新设置。
二.thrift安装:
1、下载thrift依赖的东西
yum -y install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel Python-devel ruby-devel crypto-utils
openssl openssl-devel
2、下载最新版本thrift,网址:http://thrift.apache.org
3、tar -zxvf thrift-0.9.0.tar.gz
移到默认安装目录
cp -r thrift-0.9.0 /usr/local/ (默认安装目录?否则可能影响到生成的thrift bin文件虽然有生成,但是找不到,安装在这里的话可以生成的thrift就在/usr/local/bin里了,这时终端输入thrift就有了,否则command not found.当然/usr/local/bin原先应该设置在$PATH里)
4、cd /usr/local/thrift-0.9.0
./bootstrap.sh (有You should add the contents of `./aclocal/libtool.m4' to `aclocal.m4'. glibtoolize: You should add the contents of `./aclocal/ltoptions.m4' to `aclocal.m4'. glibtoolize ...关于libtoolize,不管,继续下面的命令)
5、./configure --with-boost=/usr/include/ 因为boost安装在/usr/include里?
非常重要:可能这里有一个关于libtool的错误Version mismatch error. This is libtool 2.2.4, but the libtool: definition of this LT_INIT comes from libtool 2.2.6. libtool: You should recreate aclocal.m4 with macros from libtool 2.2.4 libtool: and run autoconf again.
6、make
7、make install
8、在终端输入thrift,有下面的东东,ok,install thrift success.
thrift bin文件在/usr/local/bin里
Usage: thrift [options] file
Options:
-version Print the compiler version
-o dir Set the output directory for gen-* packages
(default: current directory)
-I dir Add a directory to the list of directories
searched for include directives
-nowarn Suppress all compiler warnings (BAD!)
楼主实际上未进行第一步,且安装目录没有放在/usr/local/下,果然就。。。。。