1.磁盘分区格式说明
linux分区不同于windows,linux下硬盘设备名为(IDE硬盘为hdx(x为从a—d)因为IDE硬盘最多四个,SCSI,SATA,USB硬盘为sdx(x为a—z)),硬盘主分区最多为4个,不用说大家也知道…..所以主分区从sdb1开始到sdb4,逻辑分区从sdb5开始,(逻辑分区永远从sdb5开始…)设备名可以使用fdisk –l查看
2.分区详解
使用ssh远程连接工具登录到系统,使用fdisk -l命令查看磁盘状态
此处可以看到两块硬盘hda和hdb,第一块硬盘hda是装好系统的。hdb硬盘是未进行分区的。
本例将这个10G的硬盘分区,分区计划:分一个主分区 ,大小3G,文件格式ext3.三个逻辑分区,大小分别为2G,2G,3G。实际分区个数和大小可论情况所定。
下面就是分区的详细步骤,由于是每一步都进行了截图和说明,内容略显复杂,其实很简单。
输入 fdisk /dev/hdb 然后回车,给硬盘进行分区。如下图
输入n回车新建分区,接着再输入p回车新建主分区,如图
此处要求选择分区号在1-4间,输入1回车
First cylinder (1-20805, default 1):这里是设置分区起始的柱面,直接回车选择默认即可,回车后如下图
Last cylinder or +size or +sizeM or +sizeK (1-20805, default 20805):此处是设置分区结束柱面,+3G表示从起始柱面开始向后3G结束,也是是设置分区大小为3G,输入+3G后回车,如下图所示
此处可输入p查看分区是否成功,输入p回车,如下图:显示分区成功
接下来我们就划分扩展分区,按n回车
这里输入e,表示创建扩展分区,输入e回车
输入分区号2回车
此处直接按回车键,表示选择默认
此处也是直接回车选择默认,表示将划分第一个主分区后的磁盘全部划分个这个逻辑分区
此处可在此输入命令p查看当前分区状态,如下图
此处就开始划分扩展分区hdb2下的逻辑分区吧!接着上图,输入命令n回车
此处输入l表示选择创建逻辑分区,输入l回车
此处直接使用回车,表示选择默认
此处输入+2G,表示划分分区大小为2G,输入+2G回车
此处要按计划再划分出两个逻辑空间,输入n回车,然后输入l回车选择逻辑分区,然后直接回车选择默认起始柱面,输入+2G回车设置分区大小
下面就要将扩展分区的磁盘大小全部分给最后一个逻辑分区,输入n回车,然后输入l选择逻辑分区,然后直接回车选择默认起始柱面,最后不设置磁盘大小直接回车
再次输入p查看当前分区状态
划分的空间与我们计划划分相同,最后输入w回车,进行保存退出。
再次使用fdisk -l命令就可以查看到磁盘hdb已经分区成功。
磁盘划分成功,下面就要对分区进行格式化了
使用命令 mkfs -t ext3 /dev/hdb1
mkfs -t ext3 /dev/hdb5
mkfs -t ext3 /dev/hdb6
mkfs -t ext3 /dev/hdb7
分别对磁盘进行格式化处理,格式化为ext3文件类型
自此分区流程算是完成啦!
附:fdisk和mkfs,mkswap命令的参数解释
Fdisk命令详解:
m:获取帮助
n:新建分区
p:显示分区表
d:删除分区
b:设置卷标
w:写入分区表
t:改变分区文件系统类型
v:检验分区
l:显示fdisk所支持的文件系统代码
q:退出
文件系统的建立:
mkfs参数分区
-t文件系统类型指定建立的文件系统类型
注:mkfs –t ext3 =mkfs.ext3
-c建立文件系统之前检查有无坏道
-l文件名:从文件中读取坏道的情况
-v显示详细情况
mkswap 分区在分区上建立交换分区
例:在hdb7上建立交换分区命令如下:
mkswap/etc/hdb7
三、root密码重置
使用ubuntu的时候忘记了root密码该如何重置?
先说进入grub的方法,ubuntu最近的版本默认进入grub的方法是刚开机的时候按住shift键。
我之前使用的版本ubuntu11.10修改root重置root密码的方法:
#1、开机进入grub时(开机按住esc进入grub),用上下键移到第二行的恢复模式,按e(注意不是回车) #2、
把ro single 改成rw single init=/bin/bash , 然后按ctrl+x,就可以进入 单用户模式,进去干什么都行
了, (修改root密码的命令是passwd root,然后键入你的新密码即可, 完成后,按”ctrl+alt+delete“组合神键重启(我试
过用命令关机,重启都不行,只能用这个)。
而ubuntu的最新版本13.04的方法是:
#1、和上面的第一步一样。
ubuntu密码重置1
#2、直接按Ctrl+x进入recovery menu,选择drop to root shell,然后修改root密码。
ubuntu密码重置2
看到下面的输入框了吗?没错,现在就可以直接输入命令了。
修改root密码的时候可能会提示:Authentication Manipulation error,这时候键入以下命令:
mount -rw -o remount /,然后再修改一次密码
Authentication Manipulation error
如上图所示就是密码修改成功了。
四、unable to locate package
最近在ubuntu 10.04下面装了一个虚拟机,在虚拟机里面又装了11.04的ubuntu,装好后用apt get install 出现Unable to locate packag错误,上网上查了下,说是要sudo apt-get update 就可以了,但是本地执行sudo apt-get update 命令后出现了如下错误:
- Ign http://extras.ubuntu.com natty/main TranslationIndex
- Err http://extras.ubuntu.com natty/main Sources
- 404 Not Found
- Err http://extras.ubuntu.com natty/main i386 Packages
- 404 Not Found
- Ign http://extras.ubuntu.com natty/main Translation-en_US
- Err http://security.ubuntu.com natty-security/universe Sources
- 404 Not Found [IP: 91.189.92.200 80]
- Err http://security.ubuntu.com natty-security/multiverse Sources
- 404 Not Found [IP: 91.189.92.200 80]
- Ign http://extras.ubuntu.com natty/main Translation-en
- Err http://security.ubuntu.com natty-security/universe i386 Packages
- 404 Not Found [IP: 91.189.92.200 80]
- Err http://security.ubuntu.com natty-security/multiverse i386 Packages
- 404 Not Found [IP: 91.189.92.200 80]
- Err http://security.ubuntu.com natty-security/main Sources
- 404 Not Found [IP: 91.189.92.200 80]
- Err http://security.ubuntu.com natty-security/restricted Sources
- 404 Not Found [IP: 91.189.92.200 80]
- Err http://security.ubuntu.com natty-security/main i386 Packages
- 404 Not Found [IP: 91.189.92.200 80]
- Err http://security.ubuntu.com natty-security/restricted i386 Packages
- 404 Not Found [IP: 91.189.92.200 80]
- Ign http://security.ubuntu.com natty-security/main Translation-en_US
- Ign http://security.ubuntu.com natty-security/main Translation-en
- Ign http://security.ubuntu.com natty-security/multiverse Translation-en_US
- Ign http://security.ubuntu.com natty-security/multiverse Translation-en
- Ign http://security.ubuntu.com natty-security/restricted Translation-en_US
- Ign http://security.ubuntu.com natty-security/restricted Translation-en
- Ign http://security.ubuntu.com natty-security/universe Translation-en_US
- Ign http://security.ubuntu.com natty-security/universe Translation-en
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/main/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/restricted/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/universe/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/multiverse/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/main/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/restricted/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/universe/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/multiverse/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/main/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/restricted/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/universe/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/multiverse/source/Sources 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/main/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/restricted/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/universe/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/multiverse/binary-i386/Packages 404 Not Found
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/universe/source/Sources 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/multiverse/source/Sources 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/universe/binary-i386/Packages 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/main/source/Sources 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/restricted/source/Sources 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/main/binary-i386/Packages 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.92.200 80]
- W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/main/source/Sources 404 Not Found
- W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/main/binary-i386/Packages 404 Not Found
- E: Some index files failed to download. They have been ignored, or old ones used instead.
- chaihuasong@chaihuasong:~$ sudo apt-get install git
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- E: Unable to locate package git
发现很多源找不到,需要重新寻找更新源,最后把/etc/apt/sources.list文件中的地址换成我10.04中的etc/apt/sources.list文件后再执行sudo apt-get update 后就成功了,先贴上10.04上的source.list内容,如需要,直接替换即可
deb http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse
发现了这个源超级快的,是网易163更新服务器,亲测可用
另外附上
搜狐更新服务器:
deb http://mirrors.sohu.com/ubuntu/ lucid main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ lucid-security main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ lucid-updates main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ lucid-proposed main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ lucid-backports main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ lucid main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ lucid-security main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ lucid-updates main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ lucid-proposed main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ lucid-backports main restricted universe multiverse
这个速度也非常快,国内的源就是牛x啊~~
来自于
http://ubuntu.osgeeker.com/2008/02/zlib.html
zlib软件包所包含的库经常被一些软件的压缩或解压缩函数用到,所以如果编译软件时需要Zlib则说明这个软件正好含有压缩或解压缩函数,我们需要安装zlib软件包。
试过sudo apt-get install zlib,似乎Ubuntu官方源中不含zlib软件包,只有到zlib官方网站:
http://www.zlib.net
上下载源码来安装zlib软件包。
目前最新版本zlib是zlib1.2.3,安装开始;
$wget http://www.zlib.net/zlib-1.2.8.tar.gz
$tar -xvzf zlib-1.2.8.tar.gz
$cd zlib-1.2.3.tar.gz
$./configure
$make
$sudo make install
- 顶
- 0
- 踩
- 1
- 上一篇单例类型初体验与在链式调用中的应用
- 下一篇面向表达式编程之美