== Download and Install Ubuntu ==
Get Ubuntu Desktop from http://www.ubuntu.com/ and install.
Also install VitualBox Guest Addition after this.
-- X sessions and Command startx --
Note: it seems if install Ubuntu desktop in VMWare, it boots into command line. Use this to start desktop: startx
There can be multiple X sessions going simultaneously, and can be accessed using combination keys Ctrl-Alt-X, where X is F1, F2, ... F7. The default seems to be Ctrl-Alt-F7. If you start another X session inside this, then it's Ctrl-Alt-F1. An X session, when not fully loaded, can be killed by Ctrl-Z. See more: man startx.
The two possible problems below are both related to Ubuntu in VM only. The first happened to me.
-- Possible login issue --
It's possible that after you reboot machine, then you won't be able to log in. Each time it returns to the login screen after a few seconds. It might be caused by that your ~/.Xauthority file is owned by root:root. To fix, press Ctrl-Alt-F1 to enter session 1, log in console from there, and type: sudo chown me:me ~/.Xauthority, where "me" is your account name. See [7].
-- 3D acceleration --
3D acceleration by GPU guratantees after speed, otherwise 3D acceleration is done by software and slow. See [8].
== Install LAMP ==
-- Apache2 --
sudo apt-get install apache2
-- PHP --
sudo apt-get install php5
-- PHP Client (not necessary, this is console client) --
sudo apt-get install php5-cli
-- restart apache (not necessary, since it's already restarted) --
Use either of the 2 commands below:
sudo /etc/init.d/apache2 restart
sudo service apache2 restart
-- MySQL --
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Then optionally do the following:
-- activate mysql --
sudo mysql_install_db
-- change root password, and other security settings --
sudo /usr/bin/mysql_secure_installation
== Verify LAMP Installation ==
Now, Apache root is: /var/www/html/. There is already a index.html file there.
This can be visited as http://localhost
Create a php file phptest.php under the root, with content: <?php phpinfo(); ?>
This can be visited as http://localhost/phptest.php
Visit mysql from command line:
> mysql -u root -p
== Network Setup ==
You want to be able to access guest's webserver from host so it's more useful.
In VMWare Player, with networking set to NAT you can access the guest from host using guest's IP:
http://[guest ip]/
However, it seems VirtualBox does not allow this.
Recommendation for VirtualBox is to use Bridged Network, then host can access guest. However the guest loses ability to access Internet.
One way in this case is to use NAT but enable port forwarding, so host will route such request to guest.
To do this (you can change setting with guest running), go to Settings -> Adapter 1 (NAT), click on button "Port Forwarding", and enter this:
Name: Rule 1 (default)
Protocol: TCP
Host IP: (leave blank)
Host Port: 81
Guest IP: (leave blank, or use the IP found by ifconfig)
Guest Port: 80
Then in host browser, type: http://localhost:81, you will see 10.0.2.15:80 (which is not accessible if visit directly from host).
See:
- https://www.virtualbox.org/manual/ch06.html#natforward
- http://askubuntu.com/questions/353235/how-to-visit-a-site-hosted-by-my-virtual-machine
-- Note 1 --
For multiple machines hosted on VirtualBox, if they are all started, it seems they will have the same IP (found by ifconfig). I don't know how to reset their IP address (like statically), yet. But with Port Forwarding you can visit webservers of all guests from host. For example, forward the second guest's port 80 to port 82 of host.
What's more, guests can see each other. For instance, using the example above, guest 1 can see guest 2 by visit: http://[host IP]:81, and guest 2 can see guest 1 by visit: http://[host IP]:82.
-- Note 2 --
For VMWare, Port Forwarding can be setup for NAT network by using the "virtual network editor". However, the "virtual network editor" is available only to VMWare Workstation, and not available to VMWare Player.
To add the editor to VMWare Player, you can follow instructions here:
- http://www.eightforums.com/virtualization/5137-how-add-virtual-network-editor-vmware-player.html
== Install JEE Environment ==
-- Java --
See section Other Utilities below.
-- Tomcat --
To install, type:
sudo apt-get install tomcat7
Then should be able to visit http://localhost:8080.
Optionally you can install tomcat7-admin:
sudo apt-get install tomcat7-admin
Alternatively, you can download source from tomcat homepage and build it.
-- Eclipse --
Download from eclipse.com/download, extract it, then move it to a place, e.g., /home/me/Eclipse/eclipse.
And create a soft link on desktop: ln -s /home/me/Eclipse/eclipse/eclipse ~/Desktop/eclipse
== Install Mono.NET ==
See [2][3][4] for more information on Mono. To install type:
sudo apt-get install mono-complete
Install gtk-sharp2 for GTK+ support:
sudo apt-get install gtk-sharp2
Then type this to show version and enter C# shell:
csharp --version
Type this to show mono version, use mcs or gmcs, which is "csc" under windows:
mcs --version
To compile a csharp file hello.cs [4], type:
mcs hello.cs
To compile a gtk-csharp file hello_gtk.cs [4], type:
mac hello_gtk.cs -pkg:gtk-sharp-2.0
To compile a winform file hello_winform.cs [4], type (note it's gmcs, not mcs!):
gmcs hello_winform.cs -pkg:dotnet
To run aspx, install xsp2:
sudo apt-get install mono-xsp2
This will report:
* You have an incomplete /etc/xsp2/debian.webapp
* To fix it, you need to install at least one package for xsp2 (like asp.net2-examples)
This tell us the xsp2 server configuration is in /etc/xsp2. To fix it (note it's actually asp.net-examples):
sudo apt-get install asp.net-examples
Now start xsp2 server. It uses port 8080 by default, but this is in conflict with Tomcat, so use a different port, say 8082. Run the following command from the same folder as hello.aspx:
xsp2 --port 8082
Then visit http://localhost:8082/hello.aspx, it works!
To run xsp2 as a daemon, refer to [11]. Also can run this for more help:
xsp2 --help
sudo apt-get install mono-xsp2
This will report:
* You have an incomplete /etc/xsp2/debian.webapp
* To fix it, you need to install at least one package for xsp2 (like asp.net2-examples)
This tell us the xsp2 server configuration is in /etc/xsp2. To fix it (note it's actually asp.net-examples):
sudo apt-get install asp.net-examples
Now start xsp2 server. It uses port 8080 by default, but this is in conflict with Tomcat, so use a different port, say 8082. Run the following command from the same folder as hello.aspx:
xsp2 --port 8082
Then visit http://localhost:8082/hello.aspx, it works!
To run xsp2 as a daemon, refer to [11]. Also can run this for more help:
xsp2 --help
Or if install runtime only, type:
sudo apt-get installmono-runtime
sudo apt-get install memcached
Now memcached should have been automatically started under user memcache. This can be verified by one of the following 3 ways:
1) use System Monitor to view all processes to find out.
2) use command: top -u memcache
3) use command: ps -aux | grep memcached. You can see the command of the process is:
/usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1
-- start/stop/restart/status --
sudo service memcached start/stop/restart/status
-- access in console --
telnet localhost 11211
stats
== Other Utilities ==
-- Java --
Type "java" or "javac" will tell you it's not installed, and suggests the packages to install. I choose this:
sudo apt-get install openjdk-7-jdk
After installation, see version: javac -version, java -version
-- Perl --
Type "perl -v". It's installed.
-- Python --
Type "python -V". It's installed.
Try the mandelbrot drawing python script. It reports numpy not installed.
Install NumPy and SciPy (packages for scientific computing with Python):
sudo apt-get install python-numpy
sudo apt-get install python-scipy
Then run the mandelbrot.py file:
python mandelbrot.py
Compile it:
python -m py_compile mandelbrot.py
And run it:
./mandelbroth.pyc
-- Gtk+ --
See [5][6] for more information. To install GTK+ 3.0 type:
sudo apt-get install libgtk-3-dev
-- Make --
Type "make -v", it's installed.
-- Gcc --
Type "gcc -v", it's installed.
-- G++ --
Type "g++ -v", it's installed.
-- Git --
Type "git", it's not installed. To install type:
sudo apt-get install git
-- Svn --
Note installed. To install type:
sudo apt-get install subversion
== Uninstall a package using apt-get ==
Below commands are from [11].
apt-get remove packagename
This will remove the binaries, but not the configuration or data files of the package packagename. It will also leave dependencies installed with it on installation time untouched.
apt-get purge packagename, or
apt-get remove --purge packagename
This will remove about everything regarding the package packagename, but not the dependencies installed with it on installation. Both commands are equivalent.
apt-get autoremove
removes orphaned packages, i.e. installed packages that used to be installed as an dependency, but aren't any longer. Use this after removing a package which had installed dependencies you're no longer interested in.
Or could try this:
dpkg --purge --force-depends application
== Mount a VirtualBox shared folder ==
See [12]. Assume host is windows, guest is Ubuntu.
1) First you need to install Guest Additions for VirtualBox.
2) Next open Devices -> Shared Folders Settings, and choose a folder on Host to share, say name it "shared_folder".
3) In Ubuntu guest, type these commands:
sudo mkdir /mnt/host/
sudo mount -t vboxsf shared_folder /mnt/host/
That's it.
Finally, you can create a soft link to the shared folder on desktop as shortcut:
ln -s /mnt/host ~/Desktop/host
References:
[1] How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu
[2] AWS .NET SDK on Mono/Linux
[3] mono-project.com
[4] Mono basics
[5] How do I install GTK+ 3.0
[6] The GTK+ project
[7] Can't login into Ubuntu VM
[8] 3D Acceleration with Ubuntu Guests
[9] How To Install Apache Tomcat on Ubuntu 12.04
[10] How to install Mono XSP as a daemon on Debian?
[11] What is the correct way to completely remove an application?
[12] How to mount a VirtualBox shared folder?
No comments:
Post a Comment