linux问题总结

135 阅读3分钟

前言

1.­ Linux 版本分为两类?

–内核(kernel)版本

­ 是指在 Linux 领导下的开发小组开发出来的系统内核版本号。

­ 目前最新内核版本号是 kernel 2.6

–发行(Distribution)版本

­ 以 Linux kernel 为核心,搭配各种应用程序和文档,包装起来,并提供安装界面和系统设置及管理工具,构成发行版本。

2.­Linux实用工具

v 内核、 Shell 和文件系统一起形成了基本的操作系统结构

v 内核、外壳、应用是任一 OS 的基本结构

3.­内核包括

– 进程管理

– 内存管理

– 硬件设备驱动

– 文件系统驱动

– 网络管理等

4.­ Shell

Shell是系统的用户界面,是用户与内核进行交互的接口。

­ 接收用户输入的命令并把它送入内核去执行。实际上 Shell 是一个命令解释器,解释用户输入的命令,并送到内核。 (相当于 DOS 的 command.com )

­ Linux 每个用户可以拥有自己的用户界面或者 Shell, 目前主要有:

– Bourne Shell

– BASH

– Korn shell

– C shell

 

 

正文

 

1.修改redhat enterprise5 语言

问题描述:切换语言

cd /etc/sysconfig vi i18n 将LANG=en_US.UTF-8 改成LANG=zh_CN.gb2312

 

2.bash: ifconfig: command not found

问题描述:

切换到root用户下 
[root@localhost /]$ ifconfig 
依然提示:“bash: ifconfig: command not found”

 

whereis ifconfig 看一下这个命令在哪个目录下 方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了  方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin 这样设置后,下次就可以直接访问了,免处第一种的麻烦 方法三:修改/etc/profile文件,注释掉if语句即可  把下面的if语句注释掉:  # Path manipulation  if [ "$EUID" = "0" ]; then  pathmunge /sbin  pathmunge /usr/sbin  pathmunge /usr/local/sbin  fi  修改为  # Path manipulation  # if [ "$EUID" = "0" ]; then  pathmunge /sbin  pathmunge /usr/sbin  pathmunge /usr/local/sbin  #fi 

3. redhat linux开机就进入到命令行

vi /etc/inittab id:5:initdefault: 把这一句里面的5改成3就

 

4. redhat安装JDK失败

在 red hat enterprise linux5安装 jdk-7u21-linux-i586.tar.gz 时候出现下面的错误 :

Error: dl failure on line 864Error: failed /home/jiangyang/jdk1.7.0_21/jre/lib/i386/client/libjvm.so, because /home/jiangyang/jdk1.7.0_21/jre/lib/i386/client/libjvm.so: cannot restore segment prot after reloc: Permission denied

 

解决方案:

chcon -t textrel_shlib_t $JAVA_HOME/jre/lib/i386/client/libjvm.so

 

5. 设置mysql远程连接root权限

mysql> Grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option; (%表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名;‘root’则是指要使用的用户名,) mysql> flush privileges;(运行此句才生效,或者重启MySQL)

6. ubuntu 配置静态IP

root@ubuntu1:~# vi /etc/network/interfaces
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5). # The loopback network interfaceauto loiface lo inet loopback # The primary network interfaceauto eth0 iface eth0 inet staticaddress 192.168.2.111netmask 255.255.255.0****gateway 192.168.2.1
root@ubuntu1:~# /etc/init.d/networking restart

 

如果配置动态IP如下:

 

# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5). # The loopback network interfaceauto loiface lo inet loopback # The primary network interfaceauto eth0iface eth0 inet dhcp

7Ubuntu 安装 chkconfig

在Ubuntu中是没有chkconfig命令,通过安装chkconfig_11.0-79.1-2_all.deb来达到使用chkconfig命令的目的。

8.ubuntu mysql安装

安装mysql-6.0.7-alpha-linux-i686-glibc23.tar.gz版本的linux。

 

groupadd mysqluseradd -g mysql mysqlcd /usr/localgunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -ln -s full-path-to-mysql-VERSION-OS mysqlcd mysqlchown -R mysql .chgrp -R mysql .scripts/mysql_install_db --user=mysqlchown -R root .chown -R mysql databin/mysqld_safe --user=mysql &/usr/local/mysql/bin/mysqladmin -u root password ‘新密码’cp support-files/mysql.server /etc/init.d/mysqlchmod +x /etc/rc.d/init.d/mysqlchkconfig --add mysqlcp support-files/my-medium.cnf /etc/my.cnfservice mysql start

9. linux下的mysql乱码

在linux下中使用mysql的话可能会出现中午乱码的情况。通过查询mysql的编码集可以发现是使用的latin1需要修改。

 

修改/etc/my.cnf配置文件。

 

# The following options will be passed to all MySQL clients[client]#password       = your_passwordport            = 3306socket          = /tmp/mysql.sockdefault-character-set=utf8 # Here follows entries for some specific programs # The MySQL server[mysqld]port            = 3306socket          = /tmp/mysql.sockskip-lockingkey_buffer = 16Mmax_allowed_packet = 1Mtable_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_size = 256Kread_rnd_buffer_size = 512Kmyisam_sort_buffer_size = 8Mdefault-character-set=utf8

 

重启数据库后再次查看数据库的编码集信息。

 

/etc/init.d/mysql stop/etc/init.d/mysql start