日常LINUX操作一


1.use root account
http://blog.csdn.net/sunxiaoju/article/details/51993091
http://blog.csdn.net/gongchenyu/article/details/51337339
2.chrome
http://www.linuxidc.com/Linux/2016-05/131096.htm
http://blog.csdn.net/lihaoyang11/article/details/54572565
3.vmware
http://www.cnblogs.com/h2zZhou/p/5440271.html
4.kvm
http://blog.csdn.net/c80486/article/details/42836169
5.flash
http://blog.csdn.net/junbujianwpl/article/details/51587847
6.hadoop
http://www.cnblogs.com/NextNight/p/6703362.html

ssh-keygen -t rsa
ssh-copy-id user@host
7.putty
粘贴:单机鼠标滑轮,这是gnome的功能,不是putty特有的功能
8.centos7 支持ifconfig
yum provides ifconfig
yum install net-tools
9.网络操作:
查看geteway:netstat -rn
查看DNS cat /etc/resolv.conf
centos7设置hostname:hostnamectl --static set-hostname centos7

配置网关:route add default gw 192.168.122.1 dev eth0

(这个问题折腾了很长时间)centos nta模式下设置静态ip,不能访问外网的原因是网关不对,使用下面命令进行设置:
route add default gw 192.168.122.1 dev eth0
上面的命令重启后就无效
所以修改/etc/sysconfig/network文件持久设置GATEWAY=192.168.122.1,参见:http://blog.csdn.net/jcxch/article/details/48632761

 

centos7默认没有route命令,使用这个命令添加路由:ip route add 0.0.0.0/0 via 192.168.4.1 dev eth0

有时候还需要停用:systemctl disabled NetworkManager

NetworkManager是linux下的centos和ubuntu的ui网络管理工具,设置wifi,宽带链接等

10.网卡设置
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=173323da-69e3-4117-abf0-d04b03bd0a5a
DEVICE=eth0
ONBOOT=yes

IPADDR=192.168.122.11
NETMASK=255.255.255.0
GETEWAY=192.168.122.1
DNS=192.168.122.1

11.关闭防火墙,关闭selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
12.测试hadoop执行
bin/hdfs dfs -put /etc/profile /profile
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.1.jar wordcount /profile /out
bin/hdfs dfs -cat /out/part-r-00000
13.解压zip,文件名为中文时候出现乱码
unzip -O CP936 yn.zip
14.vpn客户端
https://hadler.me/linux/forticlient-sslvpn-deb-packages/
https://hadler.me/linux/openfortigui/
15.mariadb
http://www.centoscn.com/mysql/2014/0919/3778.html

[mysqld]
default-storage-engine = innodb
innodb_file_per_table
max_connections = 2048
collation-server = utf8_general_ci
character-set-server = utf8
lower_case_table_names=1


update user set password=password('root')
flush privileges;

15: Ubuntu vi 上下左右变ABCD问题解决方法

错误问题:vi上下左右键显示为ABCD的问题

解决方法:

只要依次执行以下两个命令即可完美解决Ubuntu下vi编辑器方向键变字母的问题。

  一.执行命令 sudo apt-get remove vim-common

  二.执行命令 sudo apt-get install vim

16.git客户端配置用户名密码
在~目录下创建文件:.netrc
内容为:
machine git.gongsibao.net
login fbxu@gongsibao.com
password ******

.netrc的权限只能为600
chmod 600 .netrc

 

17.配置ubuntu的源

http://www.cnblogs.com/zlslch/p/6860229.html

注意修改之后要更新:apt-get update

18.ubuntu 网卡配置

auto ens3
iface ens3 inet static
address 192.168.122.71
netmask 255.255.255.0
gateway 192.168.122.1

dns配置:

vi /etc/resolvconf/resolv.conf.d/base

添加:nameserver 192.168.122.1

说明:系统会自动生成/etc/resolv.conf 文件,不用去管他

19.ubuntu查看网卡

root@stackcontroller:/etc/network# lshw -C network
*-network:0
description: Ethernet interface
product: Virtio network device
vendor: Red Hat, Inc
physical id: 3
bus info: pci@0000:00:03.0
logical name: ens3
version: 00
serial: 52:54:00:25:01:43
width: 64 bits
clock: 33MHz
capabilities: msix bus_master cap_list rom ethernet physical
configuration: autonegotiation=off broadcast=yes driver=virtio_net driverversion=1.0.0 ip=192.168.122.71 latency=0 link=yes multicast=yes
resources: irq:11 ioport:c0a0(size=32) memory:fc096000-fc096fff memory:febec000-febeffff memory:fc000000-fc03ffff
*-network:1 DISABLED
description: Ethernet interface
product: Virtio network device
vendor: Red Hat, Inc
physical id: 9
bus info: pci@0000:00:09.0
logical name: ens9
version: 00
serial: 52:54:00:ce:f0:90
width: 64 bits
clock: 33MHz
capabilities: msix bus_master cap_list rom ethernet physical
configuration: autonegotiation=off broadcast=yes driver=virtio_net driverversion=1.0.0 latency=0 link=no multicast=yes
resources: irq:10 ioport:c140(size=32) memory:fc09a000-fc09afff memory:febfc000-febfffff memory:fc040000-fc07ffff

 

20.配置文件去掉注释和空行

cat neutron.conf |grep -v '^#' | grep -v '^$' >>neutron.config.bak

21.命令行终端打开多个tab

shift+ctl+t

22.查看版本号

yum install redhat-lsb -y
lsb_release -a

23.ider破解

修改/etc/hosts 添加:0.0.0.0 account.jetbrains.com

打开网站,获取注册码,录入idea就可以:http://idea.lanyus.com/

 

24.java执行jar包

https://www.cnblogs.com/adolfmc/archive/2012/10/07/2713562.html

 

25.git中文显示有问题时,执行如下命令:

git config core.quotepath false

不能更新有很多未追踪的文件,可以使用如下命令进行撤销(撤销到主分支):
git reset --hard origin/master

撤销所有的新增的文件(remove all untract files)
git clean -fd

git操作时出现GUN nano 2.8.6退出方法:
Ctrl+X

 26.python安装MySQL-python

sudo apt-get install libmysqlclient-dev libmysqld-dev python-dev python-setuptools
pip install MySQL-python

详见:https://www.cnblogs.com/badboyf/p/6395270.html?utm_source=itdadao&utm_medium=referral

http://blog.csdn.net/Liveor_Die/article/details/78953705

27.centos下yum代理配置

vi编辑器打开yum配置文件,一般情况下: vi /etc/yum.conf

打开yum的配置文件之后,在文件最后加上代理服务器的协议、地址、端口,如果代理服务器需要用户认证话,同时加上认证用户的用户名和密码。

代理服务器不需要认证:加上 proxy=协议://代理服务器地址:端口 (如:proxy=http://192.168.1.1:80)
代理服务器需要认证用户:加上 proxy=协议://代理服务器地址:端口 (如:proxy=http://192.168.1.1:80)

proxy_username=代理服务器用户名
proxy_password=代理服务器密码

posted on 2017-10-01 21:43  Netsharp  阅读(367)  评论(0编辑  收藏  举报

导航