Created
July 11, 2011 05:05
-
-
Save larrycai/1075333 to your computer and use it in GitHub Desktop.
create virtual machine (kvm) for ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script will run as root the first time the virtual machine boots | |
# | |
# set proxy if needed | |
sudo echo "http_proxy=http://proxy.server/" >> /etc/environment | |
export http_proxy=http://proxy.server:8080/ | |
## #Expire the user account | |
apt-get update | |
apt-get upgrade | |
### Install Open SSH | |
echo "Installing openssh-server." | |
apt-get install -qqy --force-yes openssh-server | |
### Configure phpmyadmin (adds a line to apache2.conf) | |
sudo echo 'Include /etc/phpmyadmin/apache.conf' >> /etc/apache2/apache2.conf | |
### Tomcat 6.0.18 | |
echo "Installing Tomcat 6." | |
cd /tmp/ | |
wget 'http://labs.renren.com/apache-mirror/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz' | |
tar -xvvzf apache-tomcat-6.0.32.tar.gz | |
mv apache-tomcat-6.0.32 tomcat | |
mv tomcat /opt | |
rm ./apache-tomcat-6.0.32.tar.gz | |
### MySQL database and user | |
echo "Creating database." | |
mysql -u root -e "create database xwiki" | |
mysql -u root -e "grant all privileges on xwiki.* to xwiki@localhost identified by 'xwiki'" | |
echo "Default login is 'user' and 'password'.\nYou'll change the password first thing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is run the first time a user logs in | |
# | |
echo "Your appliance is being configured." | |
### Configure the mysql server root password | |
echo "Configuring MySQL." | |
sudo dpkg-reconfigure mysql-server-5.1 | |
echo "Your appliance is now configured." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://opensourceecm.wikidot.com/ubuntu-vm-builder | |
# | |
# $ vmbuilder kvm ubuntu --debug -o -c vm.cfg 2>&1 | tee create2.log | |
# | |
[DEFAULT] | |
tmpfs = - | |
arch = i386 | |
mem = 512 | |
part = vmbuilder.partition | |
hostname = xwiki2 | |
domain = mma | |
ip = 192.168.122.45 | |
gw = 192.168.122.1 | |
dns = 192.168.122.4 | |
user = user | |
name = user | |
pass = password | |
firstboot = /home/user/vmbuild/boot.sh | |
firstlogin = /home/user/vmbuild/login.sh | |
[ubuntu] | |
#suite = intrepid | |
suite = natty | |
#mirror = http://mirrors.163.com/ubuntu/ | |
mirror = http://ubuntu.cn99.com/ubuntu/ | |
# multiverse is needed for sun-java6-jdk | |
components = main,universe,multiverse | |
flavour = virtual | |
# the following optional packages will be baked right in. | |
addpkg = apache2, mysql-server-5.1, php5, libapache2-mod-php5, php5-mysql, phpmyadmin, wget | |
[kvm] | |
libvirt = qemu:///system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root 2048 | |
/opt 1024 | |
swap 1024 | |
--- | |
/var 2048 | |
/log 1024 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment