转:http://blog.chinaunix.net/uid-14735472-id-4220089.html

云计算用一个朋友的话来说:”做云计算最苦逼的就是得时时刻刻为一些可能一辈子都碰不到的事做

好准备。更苦逼的就是刚以为一个问题不会遇到,立刻就发生了。。。“。这个还真的没有办法,

谁让哥我是搞云计算的呢,简单一个虚拟化就搞的你蛋疼,你还能想其它的吗?一直纠结在做虚

拟化使用什么镜像格式,刚刚开始用了raw的file,后来发现LVM的很多特性对于虚拟化还是有比较

理想的能力,而且性能也很不错就用了LVM。后来被VMware骗了跑去搞Esxi接触了VMDK,最近

研究openstack发现了qcow2格式,貌似现在很流行呀。也说不上分析这些镜像格式的能力,就简单

说说自己的一些使用心得。

 

目前主要有那些格式来作为虚拟机的镜像:

raw


(default) the raw format is a plain binary image of the disc image, and is very portable. On filesystems that suppor

t sparse files, images in this format only use the space actually used by the data recorded in them.

老牌的格式了,用一个字来说就是裸,也就是赤裸裸,你随便dd一个file就模拟了一个raw格式的镜

像。由于裸的彻底,性能上来说的话还是不错的。目前来看,KVM和XEN默认的格式好像还是这

个格式。因为其原始,有很多原生的特性,例如直接挂载也是一件简单的事情。
裸的好处还有就是简单,支持转换成其它格式的虚拟机镜像对裸露的它来说还是很简单的(如果

其它格式需要转换,有时候还是需要它做为中间格式),空间使用来看,这个很像磁盘,使用多

少就是多少(du -h看到的大小就是使用大小),但如果你要把整块磁盘都拿走的话得全盘拿了

(copy镜像的时候),会比较消耗网络带宽和I/O。接下来还有个有趣的问题,如果那天你的硬盘

用着用着不够用了,你咋办,在买一块盘。但raw格式的就比较犀利了,可以在原来的盘上追加空间:
dd if=/dev/zero of=zeros.raw bs=1024k count=4096(先创建4G的空间)
cat foresight.img zeros.raw > new-foresight.img(追加到原有的镜像之后)

转:http://my.oschina.net/feedao/blog/223497

当我们把CentOS 6.5安装好以后,可以使用这个脚本来使用国内的阿里云镜像源

?
1
2
3
4
5
6
7
#!/bin/bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum makecache

 

 

有了国内的源地址,后面安装东西就方便了。

搜索docker,可以看到docker-io.x86_64和docker-registry.noarch,安装docker就简单了。

[root@localhost ~]# yum search docker
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
======================================================== N/S Matched: docker =========================================================
python-docker-py.x86_64 : An API client for docker written in Python
docker-io.x86_64 : Automates deployment of containerized applications
docker-registry.noarch : Registry server for Docker
fedora-dockerfiles.noarch : Example dockerfiles to assist standing up containers quickly
imagefactory-plugins-Docker.noarch : Cloud plugin for Docker
docker.x86_64 : KDE and GNOME2 system tray replacement docking application

转:http://zhaohe162.blog.163.com/blog/static/38216797201402234212981/

本文演示在Linux上安装NodeJS及Express开发框架
 
软件环境:
VMware 9
CentOS 6.5
NodeJS v0.10.24

 
安装过程:

Step 1、确认服务器有nodejs编译及依赖相关软件,如果没有可通过运行以下命令安装。

[root@BobServerStation local]# yum -y install gcc gcc-c++ openssl-devel

Step 2、下载NodeJS源码包并解压。

[root@BobServerStation local]# wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz

[root@BobServerStation local]# tar zxvf node-v0.10.24.tar.gz
[root@BobServerStation local]# cd node-v0.10.24

CentOS默认是不支持Ext4.所以你需要处理一下才行。

使用环境使用的是CentOS5.8 内核是  2.6.18-238.19.1.el5

其实CentOS 5.8 里面是有 ext4 模块的,只是没加载,所以我们先把模块加入系统

# cd /lib/modules/2.6.18-238.19.1.el5/kernel/fs/ext4   //ext4模块就在此目录下

# [root@linux ext4]# ls

ext4.ko

找到模块后使用modprobe 命令添加

# modprobe ext4    //注意:这里只能写模块名,不能写成 ext4.ko

# lsmod |grep ext4  //添加完后使用lsmod 查看

ext4                  285409  0

jbd2                   47744  1 ext4

crc16                   1027  1 ext4

[root@linux ext4]# yum install e4fsprogs     //最后使用yum 安装一下 e4fsprogs

[root@linux ext4]# mkfs.ext4 /dev/sdc    //最后创建一个分区来使用ext4 创建文件系统

mke4fs 1.41.12 (17-May-2010)
/dev/sdi is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61014016 inodes, 244056064 blocks
12202803 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
7448 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune4fs -c or -i to override.
[root@linux ext4]#mount /dev/sdc /hadoop1 

在CentOS 6下安装Xen,有点麻烦,因为自CentOS 6开始,虚拟化平台已经从xen转向KVM,所以在CentOS 6安装KVM还是非常的简单的。

1、安装KVM
yum groupinstall Virtualization 'Virtualization Client'

2、安装api支持
yum install libvirt
service libvirtd start

3、验证是否已经载入KVM模块
$ lsmod | grep kvm
kvm
kvm_intel

4、使用virt-manager安装guest
virt-manager是一个api gui工具,可以很方便的管理虚拟机。下面简单介绍使用virt-manager安装虚拟机系统。
1)打开virt-manager,Add-connection,hypervisor选择QEMU/KVM,点击connect。
2)在连接localhost(QEMU)右键-NEW,输入guest名称,还有选择安装方式,我这里选择iso文件安装,点击forword。 www.2cto.com
3)选择iso文件路径,点击forword。
4)定义分配内存及cpu个数。
5)定义磁盘映像大小。
6)下一步就是常规的系统安装了。

5、使用virt-install安装guest
当你的CentOS没有桌面环境时,可以使用virt-install命令安装,如:
1、输入虚拟机名称
2、分配多少内存
3、定义虚拟机磁盘映像的位置
4、此步可以直接输入iso的位置或是url
5、进行系统常规安装

作者 朱茂海

转自:http://www.netingcn.com/aliyun-install-gcc.html

以前使用的aws和盛大的云主机,直接用yum来安装gcc,一条命令就搞定,命令为:

yum -y install gcc  gcc-c++

今天准备开始用阿里云,申请了一台centos 64位机器,使用上述命令安装gcc时出错,听说是阿里云处于安全考虑,生产环境不提供编译工具。想要安装不是不可能的,很简单,只有修改一下/etc/yum.conf文件即可,把文件中的

exclude=kernel*

行注释即可,注释符号为#。也可以使用如下命令来安装:

 

sed -i 's/^exclude/#exclude/'  /etc/yum.conf && yum -y install gcc gcc-c++ && sed -i 's/^#exclude/exclude/'  /etc/yum.conf

shell> rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
shell> vi /etc/yum.repos.d/utterramblings.repo

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

(3) 关闭yum fastestmirror 功能
shell> vi /etc/yum/pluginconf.d/fastestmirror.conf

enabled=0

介于机房不提供用户流量查询服务,故自行安装。

yum install mysql mysql-server php php-mysql zlib libpng freetype libjpeg fontconfig gd libxml2 rrdtool net-snmp net-snmp-utils net-snmp-devel cacti

 

以上便于记录

CentOS5(X86)  http://mirrors.sohu.com/fedora-epel/5/i386/epel-release-5-4.noarch.rpm

CentOS6(X64) http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm

http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm

其他版本以此地址自行搜索即可

-----------------------------

CentOS 5.5 yum更新源推荐--163、搜狐、中科大

更新方法如下:

先进入yum源配置目录cd /etc/yum.repos.d备份系统自带的yum
mv CentOS-Base.repo CentOS-Base.repo.save

下载其他更快的yum
中科大的yum源:
wget http://centos.ustc.edu.cn/CentOS-Base.repo

163的yum源:
wget http://mirrors.163.com/.help/CentOS-Base-163.repo

sohu的yum
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

更新玩yum源后,建议更新一下,使操作立即生效
yum makecache

When installed on a virtual machine that is running a supported Linux operating system, Linux Integration Services for Hyper-V provides the following functionality:

  • Driver support for synthetic devices: Linux Integration Services supports the synthetic network controller and the synthetic storage controller that were developed specifically for Hyper-V.
  • Fastpath Boot Support for Hyper-V: Boot devices now take advantage of the block Virtualization Service Client (VSC) to provide enhanced performance.
  • Timesync: The clock inside the virtual machine will remain synchronized with the clock on the host.
  • Integrated Shutdown: Virtual machines running Linux can be shut down from either Hyper-V Manager or System Center Virtual Machine Manager, using the "Shut Down" command.
  • Symmetric Multi-Processing (SMP) Support: Supported Linux distributions can use up to 4 virtual processors (VP) per virtual machine.

 

1. Download Linux Integration Components v2.1

a. Download Linux Integration Components v2.1 from Microsoft Download site.

b. Extract the .exe file into a temp folder. You will need only LinuxIC v21.iso file.

c. Place the LinuxIC v21.iso file into your VM host server where you can mount the ISO as a CDROM for your Centon Virtual Machine.

 

2. Installation

You will need Development Tools installed to be able to compile the Integration Components. You could do that by running yum:

yum groupinstall "Development Tools"

NOTE: This command will try to use your network connection to download and if you used Synthetic Network Adapter for your Hyper-V machine you will not have internet connection. So make sure to install Development Tools during your Centos initial installation.

Now make sure you added LinuxIC v21.iso file to your Hyper-V CDROM as Image.

As the root user, mount the CD in the virtual machine by issuing the following commands at a shell prompt:

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom

Copy Linux Integration Services to the virtual machine and unmount CDROM that no longer needed:

mkdir /opt/linux_ic_v21_rtm
cp –R /mnt/cdrom/* /opt/linux_ic_v21_rtm
umount /mnt/cdrom

As the root user, run the following command to compile and install the synthetic drivers:

cd /opt/linux_ic_v21_rtm/
make
make install

NOTE: If you're using the x64 version of Centos, you have perform an extra step.