第一次安装LFS 不指定

babo , 2009/12/21 08:23 , Linux , 评论(0) , 阅读(266) , Via 本站原创
在经过了大约40小时左右,我的LFS终于顺利启动了。从内核到系统每一个软件都是自己从源代码编译的,感觉很爽。

本次安装采用LiveCD 6.3作为宿主系统,在VMware上的一个8G scsi盘上安装。

首先碰到的问题就是GCC编译出现问题。后来发现是因为我用的liveCD是64位的问题。

换了liveCD 32位的。问题解决

第二个问题就是glibc总编译不过去,后来发现是我的Linux-2.6.22.5 API Headers从网上下的版本不对

我一直是看着LFS BOOK 6.2的中文手册安装的,而用的LiveCD和软件包都是6.3

6.3里面的这个Linux-2.6.22.5 API Headers需要从Linux-2.6.22.5.tar.bz2里面获取

建议还是看liveCD启动后/usr/share/LFS-BOOK-6.3目录下的文档,这个文档和liveCD带的软件包配套的。

或者参考中文的

手把手教你如何建立自己的Linux系统 第二版 作者:孙海勇

其他就没有碰到什么大问题了。也就是忘记安装个软件包、或者关机重启后,如何从liveCD恢复到工作状态。

通过这次安装,让我觉得LFS真的是学习Linux的捷径。而且发现了一个牛人的博客,就是上面的孙海勇  网名 冲天飞豹  http://youbest.cublog.cn/

博客里面有大量关于构建linux系统的技术文章,而且都是原创。

而且这次通过安装LFS,也找到了Linux 如何在控制台显示UTF-8中文的办法。原来是要给内核打补丁才可以。
点击在新窗口中浏览此图片


具体的办法可以看

内核补丁:字符终端下显示UTF-8字符

总结

安装是顺利完成了,后面要学习的内容还有很多。比如安装时候的每一个包都包含的什么内容、每一条配置的用途。这些安装手册配置容易,如果没有手册自己弄起来就难了。所以后面的时间,就是自己看文档,消化这些知识了。至少顺利迈出第一步!

ubuntu 9.04安装xen 不指定

babo , 2009/12/21 08:22 , Linux , 评论(0) , 阅读(340) , Via 本站原创

主要参考下面两旁文章,先贴过来,以后再整理。

http://oceanobservatories.org/spaces/display/CIDev/Xen+on+Ubuntu+9.04+(Jaunty)

http://linux.com/community/blogs/Xen-Create-a-Jaunty-DomU-using-xen-create-image.html

安装xen

Xen on Ubuntu 9.04 (Jaunty)

Added by Thomas Im , last edited by Thomas Im on Jun 11, 2009  (view change)

Labels: 

(None)

Following applies to Ubuntu 9.04 Jaunty 64-bit installation.  Notes taken from rebuild of 'amoeba' development system.

Installation

sudo apt-get install ubuntu-xen-server # Jaunty Xen package does not include the dom0 Xen kernel so these must be installed separately  wget http://security.debian.org/debian-security/pool/updates/main/l/linux-2.6/linux-modules-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb wget http://security.debian.org/debian-security/pool/updates/main/l/linux-2.6/linux-image-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb  sudo dpkg -i linux-modules-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb linux-image-2.6.26-2-xen-amd64_2.6.26-15lenny3_amd64.deb  sudo apt-get install python2.5 shutdown -r now   sudo vim /etc/network/interfaces .. auto eth0 iface eth0 inet static   address xxx.xxx.xxx.xxx   gateway xxx.xxx.xxx.xxx   netmask 255.255.255.0   sudo vim /etc/resolv.conf ... domain ucsd.edu search ucsd.edu  nameserver xxx.xxx.xxx.xxx nameserver xxx.xxx.xxx.xxx   sudo /etc/init.d/networking restart  

Create Jaunty DomU (Guest)

[http://linux.com/community/blogs/Xen-Create-a-Jaunty-DomU-using-xen-create-image.html]


References:

https://help.ubuntu.com/community/Xen
http://www.infohit.net/blog/adate/053109/archive/1.html
http://www.chrisk.de/blog/2008/12/how-to-run-xen-in-ubuntu-intrepid-without-compiling-a-kernel-by-yourself/

安装guest系统

These are instructions for creating an Ubuntu Jaunty DomU on Debian Lenny Dom0 using Xen 3.2.1 that comes with Lenny.  I'm installing into an LVM rather than using a file image.  See this HowtoForge article for background of my particular setup.  This tutorial assumes you're working from a similar setup with an iscsi target and LVM-based VMs.

The reason I'm posting this is because I had such a hard time finding some combination of tools that worked correctly to do this.  I tried a few options but had little success:

  • debootstrap - Didn't seem to work with Jaunty at all.  It would just crash
  • vm-install - Doesn't support LVM-based VMs by default, but there is a procedure for converting the qcow image to an LVM
What I found is that I could find no way of creating the LVM-based VM in Lenny.  I actually had to create a sid instance first and then install my open-iscsi and xen-utils into the sid VM, then use SID to populate the VM. 
Perform the following actions in your SID vm or workstation
Note:  You'll need your /etc/xen-tools/xen-tools.conf setup like the instructions in the HowtoForge article (things like gateway, netmask, broadcast, passwd, fs type, install-method, etc).
Whenever I would try to build the vm with the default partitions, it would always fail.  For some reason the resulting vm would have an fstab that shows something like sda1 and sda2 instead of xvda1 and xvda2.  I had to create my own partition scheme before anything would work right.  Here's mine:

$ sudo cat /etc/xen-tools/partitions.d/with-data
[root]
size=4G
type=ext3
mountpoint=/
options=sync,errors=remount-ro
[swap]
size=512M
type=swap
[data]
size=4G
type=ext3
mountpoint=/data
options=nodev

You will need to create a symlink for jaunty so that the option is recognized at the command-line. 

$ cd /usr/lib/xen-tools

$ sudo ln -s edgy.d jaunty.d 

Now, finally, you can create the image.  This step may take some time

$ xen-create-image --hostname=myserver --dhcp --lvm=vg_xen --dist=jaunty --mirror=http://archive.ubuntu.com/ubuntu --size=4Gb --memory=512Mb --swap=512MB --arch=i386 --partitions=with-data

Since you're building the LVM on a different machine than it will eventually run on, you'll need to  copy the resulting xen config to the correct server:

$ scp /etc/xen/myserver.cfg root@realhost:/etc/xen/

That should be all you need to get this working.

安装和使用xen-shell 不指定

babo , 2009/12/21 08:21 , Linux , 评论(0) , 阅读(194) , Via 本站原创

转自:http://www.xen-tools.org/software/xen-shell/install.html

Installing & using the Xen-Shell

This shell makes several assumptions in the way that it operates:

  • That you have a Xen 3.x host running.
  • Then Xen host has several guests running.
  • That you don't wish to give your users shell access on the host.

If these assumptions are not valid for your environment then you might find that you have problems.

Installation

Download either a release, or a current version of the CVS repository and install it by executing:

make install 
Configuring Users

Each user is expected to login directly to the xen-shell, and not have any other access to the host system. To do this change their login shell by running:

chsh -s /usr/local/bin/xen-login-shell username 

This will ensure when they connect to the system they will login to the shell, and run it within GNU Screen.

Note: CVS and Debian binary packages use /usr/bin instead of /usr/local/.

Once you've changed the shell for the user you must update your Xen configuration files so that they include the username(s) of the users who can control them.

To allow the user "bob" and the user "steve" to control the Xen guest "builder.my.flat" you would add the following to /etc/xen/builder.my.flat.cfg:

# All instances must have a name name = 'builder.my.flat'     # These users may control this instance. xen_shell = 'bob, steve' 
Bandwidth Accounting

The shell allows the user to view the bandwidth they have transferred over a given period, using the bandwidth command.

For this to work the vnstat tool must be installed and configured upon dom0. It is assumed that each Xen guest will have their network interface named the same as the guest name.

For example a Xen guest called 'skx' will have a network interface 'skx' upon dom0. If you're using the standard Xen configuration setup you can achieve this by changing your skx.cfg file to read:

vif = [ 'vifname=skx,ip=1.2.3.4' ] 

Note: if you have more than one IP address allocated to a guest you will have to create a more complicated setup.

Security

Since the xen administrator command xm requires root privileges to run you will need to configure sudo to allow the users who are running your shell to execute that command, without being prompted for a password, as root.

Add something similar to the following to your /etc/sudoers file:

User_Alias   XENUSERS = steve,bob,fred,foo Cmnd_Alias   XEN      = /usr/sbin/xm Cmnd_Alias   XENIMG   = /usr/bin/xen-create-image XENUSERS     ALL      = NOPASSWD: XEN,XENIMG 

Note: you only need to grant the ability to run xen-create-image if you wish to enable reimaging support in the shell.

DNS Updates

When the shell starts it will look for the file ips.txt in the home directory of the user who connects. If that file doesn't exist then the rdns command will be disabled.

If you wish to allow users to control their reverse DNS create that file and give it contents such as these:

192.168.1.1 foo.my.domain 192.168.1.2 bar.my.domain 

This file will be updated by the user when they invoke the rdns command. It is up to you to read the files and create the corresponding zonefiles / DNS updates. The shell will only manipulate the file - not push DNS updates itself.

Reimaging Support

If a user connects to the shell and has the executable file image.sh in their home directory the reimage command will be enabled.

When the user invokes the command the image.sh script is executed after prompting for confirmation, and performing a last-chance count-down.

It is up to you to create and configure this script to do the right thing. A sample file for user bob could look like this:

#!/bin/sh /usr/bin/xen-create-image --hostname=bob \  --ip=192.168.1.1  \  --ip=192.168.1.2 \  --size=9.5G \  --swap=512M  --mem=256M \  --force 

This will require a correctly configured instance of xen-tools and the sudoer file to contain the ability for the user to run xen-create-image.

Any remaining questions? contact the author.

获取XEN guestOS的images文件 不指定

babo , 2009/12/21 08:19 , Linux , 评论(0) , 阅读(255) , Via 本站原创

我们可以从http://stacklet.com/其实就是原来http://jailtime.org/站点找我们需要的xen image文件

在2009年的时候,jailtime.org发布了一个新闻

May 4th, 2009

The jailtime project has been relaunched with a new name and site: Stacklet

As part of the relaunch all of the distributions currently on jailtime have been upgraded to their latest versions. Also, all of the code for creating the images is now publically available – see http://stacklet.com/ for further details....

Jailtime will remain online but downloads will probably be turned off eventually as the transition to stacklet proceeds.

所以现在就访问http://stacklet.com/就可以了。

包括如下系统

  • 下面是一个站点提供的img文件的简单说明

    All files on this site are provided without guarantee or warranty. Use at your own risk.

    Each download is a bzipped tarball containing an image and cfg files:

    • a xen guest filesystem

    • sample xen configuration files to be used with xm create

    The naming convention of the download tarball is:

    <distribution>.<distro-version>.<created-date>.img.tar.bz2.

    For example centos.5-3.x86.20090423.img.tar.bz2 contains

    • centos.5-3.x86.img

    • centos.5-3.x86.xen3.cfg

    • centos.5-3.x86.xen3.pygrub.cfg(这个文件比较重要,如果用的是CentOS 5.3的虚拟化,就需要这个文件才可以启动guestOS。因为CentOS 5.3没有提供Xen-U的内核。)

    All of the packages installed in the image will be the latest versions available as of the created date, which is in yyyy-mm-dd format.

    Prerequisites

    1. Working installation of Xen version 3

    2. The xen daemon (xend) must be running

    3. Enough filesystem space to accomodate the uncompressed tarball (generally 1GB)

    4. Enough unallocated RAM to run the xen guest (generally 128MB)

    Default Configuration and Networking

    Each filesystem is configured to use dhcp. The *.xen.cfg also is also configured for dhcp. It is recommended that you first test the filesystem using dhcp if possible before attempting other networking parameters. Each download page has additional notes on networking that is appropriate for a particular distribution.

    The root login is root/password. It is highly recommened that you change the root password immediately.

    Installation

    You will need to uncompress the tarball to a local directory and edit the *.xen.cfg file to point to the uncompressed image and swap file.

    If all is well you will see the guest’s boot messages scrolling by.

    一些HOWTO文档

    HOWTO: Filesystems

    In the following howto’s, <image file> should be replaced with a reference to a specific .img file.

    How do I mount an image without booting it?

    • mkdir -p /mnt/loop

    • mount -o loop <image file> /mnt/loop/

    How do I resize an image file?

    First, make sure that the image file is not already mounted and is not already running as a xen guest. The following commands increase an image file to 2.5GB. Backup the image before attempting this.

    • dd if=/dev/zero of=<image file> bs=1M conv=notrunc count=1 seek=2500

    • losetup /dev/loop0 <image file>

    • e2fsck -f /dev/loop0

    • resize2fs /dev/loop0

    • e2fsck -f /dev/loop0

    • losetup -d /dev/loop0

    You may then boot or mount the image to confirm the increased size. The e2fsck checks in this howto are not strictly necessary.

    How do I move the contents of an img file to a regular partition?

    Mount the img file using the above howto. Assuming the destination partition is mounted at /mnt/dest, execute the following:

    • cp -a /mnt/loop/* /mnt/dest/

    You will then be able to boot the filesystem using the partition instead of the image file, which should provide better performance. You will need to update the *.xen.cfg file to reference the partition instead of the img file (the disk parameter will need to change, see the Xen Manual). Also, remember to unmount partitions or img files before booting a xen guest from them!

  • CentOS虚拟化服务的配置 不指定

    babo , 2009/12/19 04:14 , Linux , 评论(1) , 阅读(593) , Via 本站原创
    单位到了一台sun的x4450服务器,打算开学前部署好虚拟化服务,给每位带学生实训的老师一台虚拟的windows 2003 Server. 大约需要20台虚拟服务器

    服务器介绍
    点击在新窗口中浏览此图片


    硬件配置:

    CPU: 4颗 Intel(R) Xeon(R) CPU           X7460  @ 2.66GHz   (每颗6核心,供24核心)

    内存: 64G

    硬盘: 8块 Vendor: HITACHI   Model: H101414SCSUN146G  Rev: SA25

    虚拟方案

    用CentOS 5.3 64bit 作为DOM0,来管理整个虚拟化服务。然后采用hvm方式虚拟20台Windows server 2003。

    虚拟服务器配置:

    CPU:1颗

    内存:1G

    硬盘:30G

    整体结构如下
    点击在新窗口中浏览此图片


    在SunFire X4450的硬件上,安装Xen虚拟化服务。所有硬件由Xen内核管理,我们的CentOS 5.3 64bit操作系统跑在Xen内核上面,负责管理以后创建的DOM1到DOMN的多个虚拟服务器。

    虚拟化服务的安装

    这个就不具体写了,可以参考我前面的blog或者

    http://www.howtoforge.com/paravirtualization-with-xen-on-centos-5.3-x86_64-p2

    如果不安装图形界面,在用virt-install安装windows操作系统的时候,需要VNC服务。这样可以远程通过VNC客户端连接来安装,因为ssh的方式没有图形界面。

    如果安装了图形界面的CentOS,就很容易了。直接用图形界面的虚拟机管理程序安装即可。

    GUESTOS的配置

    由于每台虚拟服务器安装后,并没有开启远程服务,所以我们还是需要通过VNC连接登入虚拟服务器。在配置好IP和远程服务后,就可以使用远程桌面登陆了。

    在每台虚拟服务器的配置文件里,加入如下语句

    vnc = 2
    vncunused = 2
    vnclisten = "10.10.15.151"
    vncpasswd = "password"

    注意:password为登陆vnc的密码,根据实际情况设置。vnclisten设置的是主机CentOS的IP

    突破8台虚拟服务器的限制

    默认安装后,CentOS的max_loop最大值是8,这样我们默认只能启动8个虚拟服务器(不过半虚拟的linux好像不受这个影响)

    我们需要修改这个参数

    rmmod loop

    echo "options loop max_loop=64">/etc/modprobe.d/loop

    modprobe loop

    这样就可以了。

    配置网络

    我的服务器是有4块网卡 eth0、eth1、eth2、eth3

    我打算eth0 采用10.10.15.151 ip地址,其他网卡不设置IP地址并且将/etc/sysconfig/network-scripts/下对应的脚本文件修改如下

    ONBOOT=no

    这样可以让系统启动后,就eth0可以用来访问。其他网卡都没有对应ip地址

    其他网卡的作用是留给虚拟服务器用的。我们通过修改xen的配置文件,让eth0到eth1绑定到xenbr0到xenbr3上面。然后20台服务器,10台通过xenbr1访问网络,10台通过xenbr2访问

    在rc.local文件里,添加

    /etc/xen/scripts/new-bridge start

    new-bridge是我们自己写的脚本文件,为了创建xenbr0到xenbr3。xen系统默认就创建一个xenbr0

    new-bridge文件内容如下

    vi /etc/xen/scripts/new-bridge

    #######################################################################
    #!/bin/sh
    # Exit if anything goes wrong.
    set -e

    # First arg is the operation.
    OP=$1
    shift

    script=/etc/xen/scripts/network-bridge.xen

    case ${OP} in
    start)
              $script start vifnum=0 bridge=xenbr0 netdev=eth0
              $script start vifnum=1 bridge=xenbr1 netdev=eth1
              $script start vifnum=2 bridge=xenbr2 netdev=eth2
              $script start vifnum=3 bridge=xenbr3 netdev=eth3
    #         $script start vifnum=2 bridge=xenbri netdev=dummy0
              ;;

    stop)
              $script stop vifnum=0 bridge=xenbr0 netdev=eth0
              $script stop vifnum=1 bridge=xenbr1 netdev=eth1
              $script stop vifnum=2 bridge=xenbr2 netdev=eth2
              $script stop vifnum=3 bridge=xenbr3 netdev=eth3
    #         $script stop vifnum=2 bridge=xenbri netdev=dummy0
              ;;

    status)
              $script status vifnum=0 bridge=xenbr0 netdev=eth0
              $script status vifnum=1 bridge=xenbr1 netdev=eth1
              $script status vifnum=2 bridge=xenbr2 netdev=eth2
              $script status vifnum=3 bridge=xenbr3 netdev=eth3
    #         $script status vifnum=2 bridge=xenbri netdev=dummy0
             ;;

    *)
              echo 'Unknown command: ' ${OP}
              echo 'Valid commands are: start, stop, status'
              exit 1
    esac
    ########################################################################

    安装xen-shell,让用户自己管理自己的虚拟服务器

    具体安装步骤就不写了,参考我前面的文章吧

    安装和使用xen-shell
    或者
    http://www.xen-tools.org/software/xen-shell/install.html

    注意

    安装这个,需要screen这个软件,可以通过yum install screen安装

    再有就是需要/etc/xen/下面的虚拟机配置文件有对应的权限

    安装后,用root用户,直接输入xen-shell看看能不能进入,如果报错,根据提示修改。

    全部安装完成后,让我们看看20台虚拟服务器跑起来的效果
    点击在新窗口中浏览此图片

    点击在新窗口中浏览此图片


    再来看看网络的使用情况
    点击在新窗口中浏览此图片


    通过上面的brctl show可以清楚的看到,虚拟服务器的网卡,都放到了xenbr1和xenbr2下面了。

    再来看看vnc登陆的界面,注意VNC登陆后,不能直接用键盘的Ctrl+Alt+Del登陆,我们可以通过右键点窗口来选择Send Ctrl+Alt+Del来实现发送这三个按键消息。
    点击在新窗口中浏览此图片


    配置好虚拟服务器的IP和远程桌面后,我们就可以采用远程桌面连接了。



    用户自己管理自己的服务器

    其实有了远程桌面,用户就可以通过这个登陆服务器,重启和修改配置了。但是如果关机以后,就没有办法开机了。

    我们安装xen-shell就能实现用户自己通过用户名和密码登陆命令行格式的界面来启动服务器。

    首先我们要给我们每台虚拟服务器建立一个CentOS系统上的用户,让后按照Xen-shell的要求配置,这个不具体介绍了,参考

    安装和使用xen-shell
    或者
    http://www.xen-tools.org/software/xen-shell/install.html

    以后用户就可以通过putty登陆到自己的虚拟服务器管理命令行了。



    xen-shell可以让用户自己启动、重启、关闭虚拟服务器,还可以查看虚拟服务器的状态、运行时间等。

    如果在用户对应目录下编写好image.sh文件,还可以让用户自己rebuild操作系统。

    有了这个,基本管理员告诉用户他的xen-shell用户,虚拟服务器的ip就ok了。其他的用户自己都可以管理了。

    其他问题

    如何让guestos随主系统自动启动,这个可以参考xen文档。

    如何克隆guestos系统,这个可以参考virt-clone

    如何安装多个linxu guest系统,这个可以参考获取XEN guestOS的images文件

    整个安装断断续续弄了大约2周,目前总算ok了。
    分页: 18/19 第一页 上页 13 14 15 16 17 18 19 下页 最后页 [ 显示模式: 摘要 | 列表 ]