| 1 | [[PageOutline]] |
| 2 | {{{ |
| 3 | #!html |
| 4 | <h1 style="text-align: center; color: blue">2.1 從 Sourece 安裝</h1> |
| 5 | }}} |
| 6 | ---- |
| 7 | == ''__2.1.1 相關套件安裝__'' == |
| 8 | {{{ |
| 9 | ### 安裝 sun Java ### |
| 10 | $ aptitude install sun-java6-jdk |
| 11 | $ update-alternatives --config java |
| 12 | |
| 13 | ### 安裝 ant ### |
| 14 | $ aptitude install ant |
| 15 | |
| 16 | ### 安裝 vlan, dhcp, openssl ### |
| 17 | $ aptitude install vlan dhcp3-server libcurl4-openssl-dev |
| 18 | |
| 19 | ### EC2 tools ### |
| 20 | $ wget http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools-1.3-26357.zip |
| 21 | $ wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools-1.3-30349.zip |
| 22 | $ unzip ec2-ami-tools-1.3-26357.zip |
| 23 | $ unzip ec2-api-tools-1.3-30349.zip |
| 24 | }}} |
| 25 | {{{ |
| 26 | #!sh |
| 27 | ### 設定環境變數 ### |
| 28 | $ vim ~/.bashrc |
| 29 | export JAVA_HOME=/usr/lib/jvm/java-6-sun |
| 30 | export ANT_HOME=/usr/share/ant |
| 31 | export EC2_HOME=/root/ec2-api-tools-1.3-30349 |
| 32 | export EC2_AMITOOL_HOME=/root/ec2-ami-tools-1.3-26357 |
| 33 | export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin:$EC2_HOME/bin:$EC2_AMITOOL_HOME/bin |
| 34 | |
| 35 | $ source ~/.bashrc |
| 36 | }}} |
| 37 | |
| 38 | == ''__2.1.2 編譯 Euc__'' == |
| 39 | * [http://open.eucalyptus.com/downloads 下載 Eucalyptus] -> 下載兩個檔案 (Euceucalyptus-1.5.1-src.tar.gzalyptus source) & eucalyptus-1.5.1-src-deps.tar.gz |
| 40 | {{{ |
| 41 | #!sh |
| 42 | ### 1.解壓縮 ### |
| 43 | $ su |
| 44 | $ sudo tar zvxf eucalyptus-1.5.1-src.tar.gz -C ~ |
| 45 | |
| 46 | ### 2.設定環境變數 ### |
| 47 | $ echo "export EUCALYPTUS_SRC=/root/eucalyptus-1.5.1" >> /root/.bashrc |
| 48 | $ echo "export EUCALYPTUS=/opt/eucalyptus" >> /root/.bashrc |
| 49 | $ source /root/.bashrc |
| 50 | |
| 51 | ### 3.安裝 Euc 相依的軟體 ### |
| 52 | $ tar zvxf eucalyptus-1.5.1-src-deps.tar.gz -C $EUCALYPTUS_SRC |
| 53 | $ mkdir -p $EUCALYPTUS/packages/ |
| 54 | |
| 55 | ### 3.1 Axis2 ### |
| 56 | $ cd $EUCALYPTUS_SRC/eucalyptus-src-deps/ |
| 57 | $ tar zxvf axis2-1.4.tgz -C $EUCALYPTUS/packages/ |
| 58 | $ vim ~/.bashrc |
| 59 | $ source ~/.bashrc |
| 60 | |
| 61 | ### 3.2 Apache(httpd) ### |
| 62 | $ tar zvxf httpd-2.2.11.tar.gz |
| 63 | $ cd httpd-2.2.11 |
| 64 | $ CFLAGS="-DBIG_SECURITY_HOLE" ./configure --prefix=$EUCALYPTUS/packages/httpd-2.2.11 --with-included-apr |
| 65 | $ make && make install |
| 66 | |
| 67 | ### 3.3 Axis2/C ### |
| 68 | $ cd $EUCALYPTUS_SRC/eucalyptus-src-deps/ |
| 69 | $ tar zvxf axis2c-src-1.5.0.tar.gz |
| 70 | $ echo "export AXIS2C_HOME=$EUCALYPTUS/packages/axis2c-1.5.0" >> ~/.bashrc ; . ~/.bashrc |
| 71 | $ cd axis2c-src-1.5.0 |
| 72 | $ ./configure --with-apache2=$EUCALYPTUS/packages/httpd-2.2.11/include --prefix=$AXIS2C_HOME |
| 73 | $ make && make install |
| 74 | |
| 75 | ### 3.4 Rampart/C ### |
| 76 | $ cd $EUCALYPTUS_SRC/eucalyptus-src-deps/ |
| 77 | $ echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AXIS2C_HOME/lib" >> ~/.bashrc ; . ~/.bashrc |
| 78 | $ tar zvxf rampartc-src-1.2.0.tar.gz |
| 79 | $ cd rampartc-src-1.2.0 |
| 80 | $ ./configure --prefix=$AXIS2C_HOME --enable-static=no --with-axis2=$AXIS2C_HOME/include/axis2-1.5.0 |
| 81 | $ make ; make install |
| 82 | $ vim $AXIS2C_HOME/axis2.xml |
| 83 | <phase name="Security"/> |
| 84 | |
| 85 | ### 3.5 Libvirt ### |
| 86 | $ aptitude install libxml2-dev libgnutils-dev |
| 87 | $ cd $EUCALYPTUS_SRC/eucalyptus-src-deps/ |
| 88 | $ tar zvxf libvirt-0.6.3.tar.gz |
| 89 | $ cd libvirt-0.6.3 |
| 90 | $ ./configure --prefix=$EUCALYPTUS/packages/libvirt-0.6.3 --without-storage-disk --without-storage-iscsi --without-storage-fs --without-storage-lvm --without-libvirtd --without-remote --without-lxc --without-kvm --without-qemu --without-sasl --without-openvz |
| 91 | $ make ; make install |
| 92 | }}} |
| 93 | |
| 94 | == ''__2.1.3 Build Euc__'' == |
| 95 | {{{ |
| 96 | ### Building Eucalyptus ### |
| 97 | $ cd $EUCALYPTUS_SRC |
| 98 | $ ./configure --with-axis2=$EUCALYPTUS/packages/axis2-1.4 --with-axis2c=$EUCALYPTUS/packages/axis2c-1.4 --with-libvirt=$EUCALYPTUS/packages/libvirt-0.6.3/ --prefix=$EUCALYPTUS |
| 99 | $ make ; make install |
| 100 | |
| 101 | ### Eucalyptus on multiple machines ### |
| 102 | # 設定 Euc 設定檔的位置 # |
| 103 | $ $EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS $EUCALYPTUS/etc/eucalyptus/eucalyptus.conf |
| 104 | |
| 105 | # 將 $EUCALYPTUS/ 同步複製到其他 nodes # |
| 106 | $ rsync -a $EUCALYPTUS/ hostname1:$EUCALYPTUS/ |
| 107 | $ rsync -a $EUCALYPTUS/ hostname2:$EUCALYPTUS/ |
| 108 | $ ... |
| 109 | }}} |