1.上传安装包到服务器
**可以使用图形化工具,如: filezilla
**可以使用sftp工具: alt+p 调出后,用put命令上传
上传(如果不cd指定目录,则上传到当前用户的主目录):
sftp> cd /home/
sftp> put C:\Users\Administrator\Desktop\day02\soft\jdk-7u45-linux-x64.tar.gz
下载(lcd指定下载到本地的目标路径)
sftp> lcd d:/
sftp> get /home/jdk-7u45-linux-x64.tar.gz
**lrzsz
2.压缩解压缩的相关命令
%%压缩解压缩%%
root@mini1 ~]# gzip access.log 压缩后变成了access.log.gz
解压gz文件: gzip -d access.log.gz
%%打包解包%%
[root@mini1 ~]# tar -cvf myfirsttarball.tar aaa/
解包:
[root@mini1 ~]# tar -xvf myfirsttarball.tar
%%一次性完成打包&&压缩的操作%%
产生压缩包:
[root@mini1 ~]# tar -zcvf my.tar.gz aaa/
解压缩包:
[root@mini1 ~]# tar -zxvf my.tar.gz
**解压安装包(-C用于指定存放的目录)
tar -zxvf jdk-7u45-linux-x64.tar.gz -C apps/
3.修改环境变量
vi /etc/profile
修改完后重新加载环境变量
source /etc/profile
4.Iptables服务相关命令
查看iptables状态
service iptables status
开启/关闭iptables
service iptables start
service iptables stop
查看iptables是否开机启动
chkconfig iptables --list
设置iptables开机启动/不启动
chkconfig iptables on
chkconfig iptables off
5.expect 交互命令
auto_ssh_copy_id() {
expect -c "set timeout -1;
spawn ssh-copy-id $1;
expect {
*(yes/no)* {send -- yes\r;exp_continue;}
*assword:* {send -- $2\r;exp_continue;}
eof {exit 0;}
}";
}
6.配置免密登录
******配置主机之间的免密ssh登陆
假如 A 要登陆 B
在A上操作:
%%首先生成密钥对
ssh-keygen (提示时,直接回车即可)
%%再将A自己的公钥拷贝并追加到B的授权列表文件/root/.ssh/authorized_keys中
ssh-copy-id B的ip