linux系列——常见问题汇总

目录

1.yum内网仓库

2.wget: command not found

3.determining if ip address is already in use

4.克隆后eth0不见的问题

5.MySQL只有information_schema 数据库,Access denied for user 'root'@'localhost' (using password:     YES)

6.You could try using --skip-broken to work around the problem

7.文件名多一个空格怎么去掉?

8.解决包冲突

9.安装完Tomcat后物理机不能访问

10.Cannot retrieve repository metadata (repomd.xml) for repository: mysql-tools-community. Please verify its path and try again

11. E325: ATTENTION   Found a swap file by the name      ".nginx.conf.swp"

12.destination host unreachable

13.determining if ip address is already in use

14.ping不通外网

15.修改登录密码

16.-bash: scp: command not found


1.yum内网仓库

1)挂载ISO镜像文件到/media/cdrom/下(拷贝的话会浪费空间)
ll /dev/cdrom  (查看设备)
mkdir /mnt/cdrom   (创建文件夹,用语挂载ISO镜像)
mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom (首先/dev/cdrom下面必须有一张盘)

2)设置开机自动挂载
vi /etc/fstab
添加下面内容:
/dev/cdrom              /mnt/cdrom              iso9660 defaults        0 0

3)创建软链接
yum install httpd
service httpd start
cd /var/www/html
ln -s /mnt/cdrom ./centos  

4)在浏览器地址栏输入192.168.1.11/centos会出现目录结构(表示配置成功)
5)其他机器修改配置:
cd /etc/yum.repos.d
cp CentOS-Media.repo CentOS-mini.repo
vi CentOS-mini.repo 

修改:
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
gpgcheck=1
enabled=0
修改为:
name=CentOS-mini
baseurl=http://centosmini/centos
gpgcheck=0
enabled=1
查看:
yum clean all
yum repolist

2.wget: command not found

yum -y install wget

3.determining if ip address is already in use

vi /etc/sysconfig/network-scripts/ifcfg-eth0 加入:
ARPCHECK=no 

4.克隆后eth0不见的问题

第一步:vi /etc/udev/rules.d/70-persistent-net.rules
删掉eth0,把eth1改为eth0
第二步:vi /etc/sysconfig/network-scripts/ifcfg-eth0
删除UUID和HWADDR
第三步:vi /etc/sysconfig/network 修改主机名
第四步:重启系统

5.MySQL只有information_schema 数据库,Access denied for user 'root'@'localhost' (using password:     YES)

1)停掉MySQL服务:
/etc/init.d/mysqld stop
2)使用safe模式,进行重启:
mysqld_safe --skip-grant-tables
3)再开一个终端,使用root账户,无密码登录:
mysql -u root
4)选择mysql database:
use mysql;
5)为root用户更改密码为: 123456(自行设定):
update user set password=PASSWORD("123456") where User = 'root';
6)停止MySQL 服务:
/etc/init.d/mysqld stop
7)重新启动MySQL服务:
/etc/init.d/mysqld start
8)使用root账户正常登录:
mysql -u root -p

6.You could try using --skip-broken to work around the problem

1)将/etc/yum.repos.d文件夹下所有repos文件转移,然后把用的那个repo拷贝回来(保证repo所在目录只有你的那1个文件) 
2)yum clean all 

7.文件名多一个空格怎么去掉?

在编辑的过程中,可能会把中文空格放在文件名中,
解决:在空格前面加一个反斜线 如:
mv tomcat7\  tomcat7

8.解决包冲突

rmp -e 冲突包名 --nodeps

9.安装完Tomcat后物理机不能访问

一:添加一个开放端口8080(添加协议):
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -L -n (查看防火墙状态)
方法二:主要原因为Centos防火墙还开着,需要关闭
 关闭防火墙指令:/etc/init.d/iptables stop
 永久关闭防火墙指令:chkconfig iptables off
 开启防火墙指令:/etc/init.d/iptables start
 永久开启防火墙指令:chkconfig iptables on
 查看防火墙状态:/etc/init.d/iptables status

10.Cannot retrieve repository metadata (repomd.xml) for repository: mysql-tools-community. Please verify its path and try again

http://mirrors.163.com/.help/centos.html
1)首先备份/etc/yum.repos.d/CentOS-Base.repo
    mv /etc/yum.repos.d/CentOS-Base.repo     /etc/yum.repos.d/CentOS-Base.repo.backup
2)把Centos-6.repo拖到cd /etc/yum.repos.d/目录下
3)运行以下命令生成缓存
yum clean all
yum makecache

11. E325: ATTENTION   Found a swap file by the name      ".nginx.conf.swp"

由于上一次编辑文本时,异常退出了,所以产生一个.nginx.conf.swp文件,这是一个隐藏文件,可以通过ll -a 命令来列出,然后删除就行了

12.destination host unreachable

配置本地真实网卡与VMnet8网卡

http://blog.csdn.net/shadow_xwl/article/details/50509797

 

 

 

13.determining if ip address is already in use

在/etc/sysconfig/network-scripts/ifcfg-eth0下加入:
ARPCHECK=no  

14.ping不通外网

1)配置本地网卡

 

2)配置虚拟网卡VMware Network Adapter VMnet8网络适配器IP设置与虚拟机IP需要在同一个网段

 

3)配置虚拟网络DHCP

 

4)NAT设置:

5)修改/etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0  #网卡接口名称
TYPE=Ethernet #网卡类型为以太网
ONBOOT=yes #系统启动时自动激活网卡
NM_CONTROLLED=no  
BOOTPROTO=none  #协议类型通常有四种:static dhcp bootp none
DEFROUTE=yes  
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes  #使用IPV4协议版本
IPV6INIT=no    #不使用IPV6协议版本
NAME="System eth0"
IPADDR=192.168.1.111   #linux的ip地址
NETMASK=255.255.255.0  #子网掩码
DNS1=114.114.114.114   #DNS服务器地址
GATEWAY=192.168.1.1    #网关
ARPCHECK=no  

6)永久关闭防火墙:
chkconfig iptables off
7)在/etc/resolv.conf下添加:
nameserver 114.114.114.114 
nameserver 8.8.8.8
8)service network restart

9)如果以上步骤不行的话,换个DNS试一下
例如:把192.168.1.1换成192.168.1.55(可能192.168.1.1被别人占用了)
主机ip地址改变,也要修改linux的ip地址

15.修改登录密码

passwd

16.-bash: scp: command not found

scp命令是进行远程复制文件,出现上述情况是某一台linux没有安装scp需要的包
在一台运行正常的CentOS 5.6服务器上找到scp所在的包:
# which scp 
/usr/bin/scp 
# rpm -qf /usr/bin/scp 
openssh-clients-4.3p2-72.el5

这么看来scp所在的包是openssh-clients了。
在不正常的机器上安装吧:
代码如下:

# yum install openssh-clients 
或者从光盘上安装 
# rpm -ivh libedit-2.11-4.20080712cvs.1.el6.x86_64 
# rpm -ivh openssh-clients-5.3p1-20.el6.x86_64
至此,scp命令可以执行了。

更多内容,请关注公众号:程序员高手之路

在公众号回复:linux   即可免费获取linux视频教程(未加密)!

 

发布了131 篇原创文章 · 获赞 1663 · 访问量 56万+

猜你喜欢

转载自blog.csdn.net/qq_26230421/article/details/102599154