Linux学习三
#设置固定IP
原因是虚机重启后IP变了,这样SSH时就要先知道IP才行,麻烦
第一种(立即生效,重启后配置丢失)
ifconfig eth0 192.168.0.10 netmask 255.255.255.0
ifconfig eth0 up
第二种(重启后生效,重启电脑,IP不会丢失)
vi /etc/sysconfig/network-scripts/ifcfg-eth0
参考配置文件
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.10
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
HWADDR=00:0c:29:dd:a6:00
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=Dhcp
IPADDR=192.168.0.10
NETMASK=255.255.255.0
DHCPCLASS=
HWADDR=00:0C:29:16:72:7E
ONBOOT=yes
#退出VI命令
先按esc,然后输入 :q! ,存盘退出输入 :wq
#设置完IP后重新启动network
service network restart
设置完IP后SSH不上了...
##重装了下CentOS先备份ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=dhcp
DHCPCLASS=
HWADDR=00:0C:29:CC:23:12
ONBOOT=yes
还是不行,"回滚"了
#安装nginx成功
#复制目录
将 /etc/ 目录下的所有内容复制到 /tmp。
[root@linux tmp]# cp /etc/ /tmp
#删除目录
rm -r /usr/local/nginx
#ldd
[root@bogon nginx]# ldd $(which /opt/nginx/sbin/nginx)
linux-vdso.so.1 => (0x00007ffff01fc000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002ac15257f000)
libpcre.so.1 => not found
libc.so.6 => /lib64/libc.so.6 (0x00002ac1527b7000)
/lib64/ld-linux-x86-64.so.2 (0x00002ac152362000)
[root@bogon nginx]#
LDD是什么命令?
NGINX启动时提示错误:
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
ldd $(which /usr/local/nginx/sbin/nginx)
linux-vdso.so.1 => (0x00007fff48ff0000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003065800000)
libpcre.so.1 => not found
libssl.so.6 => /lib64/libssl.so.6 (0x0000003067000000)
libcrypto.so.6 => /lib64/libcrypto.so.6 (0x0000003066400000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003063000000)
libz.so.1 => /lib64/libz.so.1 (0x0000003063c00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003062c00000)
libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x0000003066c00000)
libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x0000003069c00000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003068800000)
libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x0000003069000000)
/lib64/ld-linux-x86-64.so.2 (0x0000003062800000)
libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x000000306a800000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003067c00000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003068400000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003064400000)
libsepol.so.1 => /lib64/libsepol.so.1 (0x0000003064000000)
解决方法:
ln -s /usr/local/lib/libpcre.so.1 /lib64
32位系统则:
ln -s /usr/local/lib/libpcre.so.1 /lib
注:
/usr/local/lib/libpcre.so.1 为prce安装后的文件地址
低版本prce对应的libpcre.so.1 为libpcre.so.0
OK终于搞定了