操作系统(Linux)
Dec 28
利用ssh-copy-id复制公钥到多台服务器
一直都是手工用scp和ssh命令执行这一任务的,刚发现原来有这个便利的命令!
ssh-copy-id命令可以把本地的ssh公钥文件安装到远程主机对应的账户下。
ssh-copy-id命令可以把本地的ssh公钥文件安装到远程主机对应的账户下。                                                                                                          
达到的功能:
  ssh-copy-id - 将你的公共密钥填充到一个远程机器上的authorized_keys文件中。   
如果没有生成密钥对,要先生成密钥,再将公钥复制到远程主机,usernaem是远程主机的用户名,host是远程主机的ip地址或域名

#生成密钥
ssh-keygen -t rsa
#复制公钥到远程主机
ssh-copy-id username@host

bigdata01.itlife365.com
bigdata02.itlife365.com
bigdata03.itlife365.com
[itlife365@bigdata01 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/itlife365/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/itlife365/.ssh/id_rsa.
Your public key has been saved in /home/itlife365/.ssh/id_rsa.pub.
The key fingerprint is:
91:85:79:81:df:fb:50:3a:69:9d:1d:63:65:61:90:ea itlife365@bigdata01.itlife365.com
The key's randomart image is:
+--[ RSA 2048]----+
|         +o. .oo.|
|        +o.  .. o|
|        oo ..  ..|
|         .... .+ |
|        S .  *.oo|
|           EB o .|
|           . +   |
|              .  |
|                 |
+-----------------+
[itlife365@bigdata01 ~]$ ssh-copy-id bigdata01.itlife365.com
The authenticity of host 'bigdata01.itlife365.com (192.168.1.211)' can't be established.
RSA key fingerprint is 33:bc:e8:df:00:90:41:4d:66:f4:0e:35:39:d5:ed:21.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bigdata01.itlife365.com,192.168.1.211' (RSA) to the list of known hosts.
itlife365@bigdata01.itlife365.com's password:
Now try logging into the machine, with "ssh 'bigdata01.itlife365.com'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[itlife365@bigdata01 ~]$ ssh-copy-id bigdata02.itlife365.com
itlife365@bigdata02.itlife365.com's password:
Now try logging into the machine, with "ssh 'bigdata02.itlife365.com'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[itlife365@bigdata01 ~]$ ssh-copy-id bigdata03.itlife365.com
itlife365@bigdata03.itlife365.com's password:
Now try logging into the machine, with "ssh 'bigdata03.itlife365.com'", and check in:
  .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[itlife365@bigdata01 ~]$
[itlife365@bigdata01 ~]$ ssh bigdata01.itlife365.com
[itlife365@bigdata01 ~]$ ssh bigdata02.itlife365.com
Last login: Sun Dec 17 06:46:05 2017 from bigdata01.itlife365.com
[itlife365@bigdata02 ~]$ exit
logout
Connection to bigdata02.itlife365.com closed.
[itlife365@bigdata01 ~]$ ssh bigdata03.itlife365.com
Last login: Sun Dec 17 06:48:32 2017 from localhost
[itlife365@bigdata03 ~]$
[itlife365@bigdata03 ~]$ exit
logout
Connection to bigdata03.itlife365.com closed.
[itlife365@bigdata01 ~]$

----
linux ssh-copy-id
Jul 1

centos6.5安装rzsz命令
默认只要root有权限安装
[hadoop@itlife365 sbin]$ rz
-bash: rz: command not found
[hadoop@itlife365 sbin]$ sz
-bash: sz: command not found
[hadoop@itlife365 sbin]$ yum install lrzsz
Loaded plugins: fastestmirror
You need to be root to perform this command.
[hadoop@itlife365 sbin]$

[hadoop@itlife365 ~]$ su - root
Password:
[root@itlife365 ~]# yum install lrzsz
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                | 3.7 kB     00:00    
base/primary_db                                                                     | 3.7 MB     00:02    
extras                                                                              | 3.3 kB     00:00    
extras/primary_db                                                                   |  21 kB     00:00    
updates                                                                             | 3.4 kB     00:00    
updates/primary_db                                                                  | 1.9 MB     00:01    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.i686 0:0.12.20-27.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package               Arch                 Version                             Repository            Size
===========================================================================================================
Installing:
 lrzsz                 i686                 0.12.20-27.1.el6                    base                  66 k

Transaction Summary
===========================================================================================================
Install       1 Package(s)

Total download size: 66 k
Installed size: 150 k
Is this ok [y/N]: y
Downloading Packages:
lrzsz-0.12.20-27.1.el6.i686.rpm                                                     |  66 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lrzsz-0.12.20-27.1.el6.i686                                                             1/1
  Verifying  : lrzsz-0.12.20-27.1.el6.i686                                                             1/1

Installed:
  lrzsz.i686 0:0.12.20-27.1.el6                                                                           

Complete!
[root@itlife365 ~]#
安装完成后测试:在hadoop用户下就可以了
[hadoop@itlife365 sbin]$ rz
rz waiting to receive.
开始 zmodem 传输.  按 Ctrl+C 取消.
Transferring rpc-service_runable.jar...
   86%   19885 KB  864 KB/s 00:00:03 ETA   0 错误

---end by itlife365.com centos linux sz rz

Tags: , , ,
Dec 11

国内使用Linux CentOS6.5中如何修改yum源
一般默认安装的系统配置的都是国外的yum源,经常会出错,或者网络差的时候经常yum安装失败,
这时候需要更新为国内的
在安装完CentOS后一般需要修改yum源,才能够在安装更新rpm包时获得比较理想的速度。
国内比较快的有阿里云源、163源、sohu源。
这里以163源为例子。
步骤如下:root用户
1. cd /etc/yum.repos.d
2. mv CentOS-Base.repo CentOS-Base.repo.backup
3. wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
如果不能在Linux下载或者还没有安装wget 则可以通过网络访问下载本地后写入
如下的情况表示还没有安装
[root@itlife365 ~]#  wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
-bash: wget: command not found
[root@itlife365 ~]#

4. mv CentOS6-Base-163.repo CentOS-Base.repo
5.yum clean all
。。。。。
CentOS6-Base-163.repo 可以参考附件(把.txt重命名)


然后就可以安装wget了
[root@itlife365 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up Everything
[root@itlife365 yum.repos.d]# yum install wget
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                | 3.7 kB     00:00    
base/primary_db                                                                     | 3.7 MB     00:02    
extras                                                                              | 3.3 kB     00:00    
extras/primary_db                                                                   |  30 kB     00:00    
updates                                                                             | 3.4 kB     00:00    
updates/primary_db                                                                  | 3.5 MB     00:02    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.i686 0:1.12-8.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package                Arch                   Version                        Repository              Size
===========================================================================================================
Installing:
 wget                   i686                   1.12-8.el6                     base                   483 k

Transaction Summary
===========================================================================================================
Install       1 Package(s)

Total download size: 483 k
Installed size: 1.8 M
Is this ok [y/N]: y
Downloading Packages:
wget-1.12-8.el6.i686.rpm                                                            | 483 kB     00:04    
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>"
 From  : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : wget-1.12-8.el6.i686                                                                    1/1
  Verifying  : wget-1.12-8.el6.i686                                                                    1/1

Installed:
  wget.i686 0:1.12-8.el6                                                                                  

Complete!
[root@itlife365 yum.repos.d]# pwd
/etc/yum.repos.d
[root@itlife365 yum.repos.d]#

how-centos6-5-update-yum-source-in-china
---END

Tags: , ,
Nov 30

CentOS Linux出现Device eth0 does not seem to be present的解决
在Oracle VBOX里复制虚拟机出来的CentOS Linux配置完成Ip,重启网卡报错
故障现象:
service network restart
Shutting down loopback insterface:                       [  OK  ]
Bringing up loopback insterface:                         [  OK  ]
Bringing up interface eth3:  Device eth3 does not seem to be present,delaying initialization.   [FAILED]
因为我的是复制第3次,且复制的时候选择了重新初始化网卡,所以会出现eth3 (后面自己才发现的。。)

CentOS Linux解决Device eth3 does not seem to be present
ifconfig...没有看到eth0.。然后重启网卡又报下面错误。

我的解决办法:
1/首先打开/etc/udev/rules.d/70-persistent-net.rules内容如下面例子所示:

# vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:51:bd:1
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:52:bd:1
7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

然后记录下eth3网卡的mac地址00:0c:29:52:bd:17
因为我的ifcfg-eth0还没使用,所以我直接改ifcfg-eth3 为ifcfg-eth0了
2、接下来,打开/etc/sysconfig/network-scripts/ifcfg-eth0
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

将 DEVICE="eth3"  改成  DEVICE="eth0"  ,
将 HWADDR="00:0c:29:8f:89:97" 改成上面的mac地址  HWADDR="00:0c:29:52:bd:17"
3、最后,重启网络
# service network restart
或者
# /etc/init.d/network restart

正常了,如果还是不行重启虚拟机的系统(我的重启后ok)centos device
how to solve centos Device eth0 does not seem to be present

Tags: ,
Jun 19

ie访问:waimao.jiandanjie.com 报如下错误:
Forbidden
You don't have permission to access /index.html on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
Apache/2.2.15 (CentOS) Server at waimao.jiandanjie.com Port 80

参考后台log日志:
[Sun Jun 19 15:32:46 2016] [crit] [client 183.250.114.92] (13)Permission denied: /var/www/waimao.jiandanjie.com/web/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sun Jun 19 15:34:58 2016] [crit] [client 183.250.114.92] (13)Permission denied: /var/www/waimao.jiandanjie.com/web/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
百度了一下,原来是权限的问题。 chmod 755 web -R 后解决

[root@server1 waimao.jiandanjie.com]# ll
total 28
drwxr-xr-x  2 web13 client3 4096 Jun 17 23:26 cgi-bin
drwxr-xr-x  2 root  root    4096 Jun 19 15:22 log
drwx--x---  2 web13 client3 4096 Jun 17 23:26 private
drwxr-xr-x  2 root  root    4096 Jun 17 23:26 ssl
drwxrwxrwx  2 web13 client3 4096 Jun 17 23:26 tmp
drwx--x--- 12 web13 client3 4096 Jun 19 15:30 web
drwx--x---  2 web13 client3 4096 Jun 17 23:26 webdav
[root@server1 waimao.jiandanjie.com]# chmod 755 web -R
[root@server1 waimao.jiandanjie.com]#

Tags: ,
分页: 1/18 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]