Author-meta:Thomas F Wroble Author:Thomas F Wroble Title: UbuntuServer in VirtualBox Subtitle: UbuntuServer Date:20140909 encoding:utf8 version:from the desk of TFWroble mainfont: Roboto Slab documentclass: book dh:8.5in dw:6in top:0.75in bottom:0.75in lr:0.35in
This is chock full of nuts notes I jotted down to get more familiar (or 'refresh') stuff common to MSYS and GNU/Linux dev. Its very much a work in progress, so if you find anything misleading or shoddy or would like to add anything, feel free to comment.
- Mounting Windows Partitions (NTFS)
tar xvzf file.tar.gz
This document has the intention of bringing a number of topics under one hood on installing and configuring a ubuntu-server-14.04 April 2014 LTS (GNU/Linux/Debian) distribution as a development server for various things, on a Windows 7 host-machine (though this does not necessarily mean that this won't be helpful to MAC users).
We're not intent upon repeating much of the content that is in the official Ubuntu-server documentation1 nor the Debian Guide2.
What follows is my maintenance and documentation pertaining to setting up my ubuntu-server (development VM).
Personally I had chosen Debian, as over the years I noticed several Windows development cross- compile branches had been maintained
![GNU/Linux Distribution Timeline3 v12.10]
These are the steps that I had taken to set up a VirtualBox UbuntuServer.
I probably shouldn't have installed LAMP.
Alternatively calling sudo apt-get install LAMP
would have run through the exact same process.
Server admins might recommend even lighter Debian servers such as vdi-server.
- Use the UbuntuServer 14.04 amd64 LiveCD loaded into VirtualBox through a general setup in VirtualBox starting with clicking
New
. This time I'm going with a30 Gb
due to the errors I had with smaller VHDD. Also I went withVHD
(maybe this is what caused the prior error---though I doubt it). Note that you might need to change a virtualization related setting4 on your bios in order to use x64 OS images within virtualbox. - Only setup LAMP and SSH via the guided installation.
- Apply VirtualBoxAddons.
- Create a backup of UbuntuServer for future fresh-starts. Now that we have basics of LAMP and SSH, I think it would be a good idea to back up our fresh server before upgrading to keep fresh upgrades possible in any newer server convigurations.
- Install updates.
- [Install Webmin][Webmin install] Webmin up and re-apply my favorite theme.
Note that once Webmin is installed, we can use it to
- Add our favorite Webmin theme
- Install ProFTPD
- and other things
The rest of the stuff that I would like can go on different servers or all in one.
- vboxvmservice.sourceforge.net---Headless service adminstration for a Windows host.
- Install MinGW-w64 cross-compiler via Zaraone (who also builds FFmpeg for Windows). I was thinking that it might be a good idea to set up a VHD specifically for this, so that I can switch development such as this between different machines. I'll let you know how that goes if it goes well, but bare in mind, this would cater to machines that play nice.
- NFS-HOWTO
Here are some re-enforcing visions of what it is that I have found in service to the concept of working with a nice little web-stack these days which in my opinion would include PHP, RUBY/RAILS, GOLANG, APACHE, JAVA, APACHE FLEX (ADOBE FLASH PLAYER) and more.
- stackoverflow: Which Linux Distro for web development?
- lucas-nussbaum.net --- Ruby development ceveat.
Windows Host file Location
%systemroot%\system32\drivers\etc
Since I'm using a Windows 7 Home workstation as my development machine working with a (GNU/Linux) Debian/Ubuntu-server) headless VirtualBox
I would like to see a service script automatically manage /etc/host file entries so that when I start a virtual-machine in headless mode, then the particular server can or should be able to append/remove (startup/shutdown) a host configuration in the hosts file. This way, we can simply assign a name within our VirtualBox via a tool like VmServiceTray to get us booted and running with a particular host.
Otherwise, a particular domain configuration would be necessary (as far as I am aware).
I prefer Bridged networking in virtualbox.
See How to SSH to a VirtualBox guest externally through a host. The 'Answer' points out the advantage of NAT in how the outbound ports are locked and can be opened by port-forwarding in VirtualBox.
By Default SSH uses port:22 and directions are given to map to port:2022.
The important one would of course be SSH, but the table below should give a pretty good idea.
Name | Protocol | Host IP | Host Port | Guest IP | Guest Port |
---|---|---|---|---|---|
SSH | tcp | 3022 | 22 | ||
MySQL | tcp | 3066 | 66 | ||
Web | tcp | 80 | 8080 |
# how to add the rule from bash
VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22"
# varify your vm
VBoxManage showvminfo myserver | grep 'Rule'
# Install SSH using apt-get
sudo apt-get install openssh-server
# To SSH into the guest VM, write:
# replace `user` with your logon
ssh -p 3022 [email protected]
- A note for web-applications
- I would like to see SSL on for all CMS.
- Suggestively, you can just steal configuration settings (including a certificate) from another particular application such as webmin, though I would prefer to generate a custom SSL key.
- Aside from all the things that I had mentioned, I would like to see additional security layers invented.
TODO
- Joomla v333 (2014-09)
- joomla.org/download
- [ubuntuserverguide]
- jlcarrillo.wordpress.com
TODO
See Laravel
from the github page:
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.
Build Web Apps from Scratch with Laravel, the eloquent ORM
The following instructions work on Windows.
Note that in order for PEAR and related modules to function for you server, you need to be sure that any pear related files are added to your ENVIRONMENT PATH.
right-click/save-as go-pear.php
: pear.php.net/go-pear.
- Install via PHP/WEB
- Download this file and save it as go-pear.php
- Put
go-pear.php
on your webserver, where you would put your website - Open
http://yourdomain.example.org/go-pear.php
in your browser - Follow the instructions, done!
- Command-line installation (for advanced users)
- Download this file and save it as
go-pear.php
- Open a terminal/command prompt and type:
php -q go-pear.php
- Follow the instructions, done!
- Download this file and save it as
As above, note that it would help to have composer.phar in your ENVIRONMENT PATH; Therefore, it may be a good idea to place it along-side PHP binaries (which is in the PATH). Also, you might note that the instructions for composer indirectly explain how to get started with this package as far as downloading it on GNU/Linux.
See official download page, and install instructions
- this one is easy. I believe I used git, extracted it and followed general setup.
- Aside from that, it complained that I hadn't created a database for wordpress, so using [phpmyadmin], created a database for the installer to run smoothly.
- I also had to up PHP's MAX-FILE-UPLOAD and MAX-FORM-POST capacity in order for it to run smoothly, as I had done so using [Webmin][Webmin install].
This a process after following a particular tutorial I'd found on youtube.
# Source: http://sourceforge.net/projects/webadmin/files/webmin/
wget http://downloads.sourceforge.net/project/webadmin/webmin/1.700/webmin_1.700_all.deb
sudo dpkg --install webmin_1.700_all.deb
If packages are unavailable, [check apt-get sources][APT-GET insight].
- having installed LAMP+SSH with my ubuntu-install, the following were reported missing so
sudo apt-get install
the following (separated by spaces).- libnet-ssleay-perl
- libauthen-pam-perl
- libio-pty-perl
- apt-show-versions
- finally,
sudo apt-get -f install
finishes off installing webmin.- if you didn't install LAMP+SSH by default like I did, there might be more missing packages reported.
Once webmin is installed, you may want to do an upgrade through Webmin or via cmmand-line.
See Ubuntu's apt-get howto reference for more complete explanations.
- The theme I like
- using Webmin
- in the “Webmin” menu, select “Webmin Configuration” and click “Webmin Themes”
- Select the “Install theme” tab
- Check the radio-button “From ftp or http URL” and paste the url to desired theme into the corresponding text- box. Note that this will unpack the `*.file.
- Click “Install Theme” button.
- metal-webmin-theme---explains installing a Webmin theme, however this can be done simply through Webmin UI.
This is something that I've not been really able to manage into working status as of yet. Then again, what I was trying to do is hard to explain quickly and simply. (in other words this is a TODO)
- I've used Webmin, but there really was nothing that I could get working under Apache configuration.
- In stead of tinkering around with Webmin or Apache confs, I simply decided to use the public webroot to drop stuff in---for PHP dropins like Joomla, Drupal and other static stuff.
- Ruby and/or Golang configurations are worthy topics of interest in the future, however perhaps with little to no regard to Apache.
- Note: I'm not really a big fan of languages like Java (cfm), DOTNET and PYTHON, ---at least in regard to this document. Theey're great fun to play with in dedicated servers of course, but just too slow for my liking compared to machine-code or even FLEX/BISON interpreters like PHP.
From the Ubuntu page— The Dynamic Host Configuration Protocol (DHCP) is a network service that enables host computers to be automatically assigned settings from the server as opposed to manually configuring each network host. Computers configured to be DHCP clients have no control over the settings they receive from the DHCP server, and the configuration is transparent to the computer's user...
See official documentation, S??P??
TODO
For SSH and DNS related things, you are going to need to know your IP information assigned to the VirtualBox.
# Show current network configuration
sudo ifconfig
# turn off ethernet device
sudo ifconfig [device-id] down
# turn on ethernet device
sudo ifconfig [device-id] up
I jotted this down in case it might be useful to someone. After following some instruction on static-binding an IP (probably dumb on a WiFi device). This is a personal note. The ERROR was caused by my renaming the server, or both that and playing around with the IP configuration (though probably just renaming the server).
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
[ssh-key-was-here].
Please contact your system administrator.
Add correct host key in /home/oio/.ssh/known_hosts to get rid of this message.
Offending key in /home/oio/.ssh/known_hosts:2
RSA host key for 192.168.1.12 has changed and you have requested strict checking.
Host key verification failed.
I'm pretty sure that the error was caused by all the configuring I had been doing on the side of my router such as network-security settings. Particularly, my scenario seemed to have conflicted due to my new network configuration yet using the same server on the same IP.
To resolve the scenario just delete the SSH keys so a new one can be created.
This is from MSYS on my windows running a Linux-VM (MSYS on Windows).
# this will delete all files under SSH (~/.ssh/)
sudo rm ~/.ssh/known_hosts -R
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# start eth0 at boot
auto eth0
# auto DHCP (obtain IP from DHCP)
iface eth0 inet dhcp
# For a static-ip you can do as follows
# address 192.168.67.100
# netmask 255.255.255.0
# gateway 192.168.67.2
- See: ubuntu-serverguide Network Configuration
However unadvisable it may be, I've been using my WiFi for my ubuntu-server. In so doing, I was playing with my router's configuration settings, and after my computer awoke from a long nap, my IP configuration changed and now ubuntu started using ..*.10 in stead of 17 and this threw out my wordpress configuration that I just got working.
After hard-coding a static IP (WiFi) due to the fact that my VM was retaining a particular IP for over a week, my IP finally regenerated and threw my configuration. I did some simple commands to static-bind my IP again and thought it was working until I realized that it wasn't able to see the WLAN, hence I had to regenerate the basic IP configuration.
- How to turn on Network Discovery and Share between computers with Samba
- Access Windows machines from Ubuntu on local network by hostname
- Ubuntu can see network work group but can't see Ubuntu from windows
Note that I had issues and (at least convinced myself that I) had to re-install the (virtualbox-virtualization) server from scratch so that I could immediately apply the VirtualBoxAddons package. When you resize a virtual-hard-disk (VHD5), you need to use a tool like GParted to expand the particular HDD (VHDD) partition. In my particular scenario, once I used GParted to resize the partition, it reported properly in GParted, but not in UbuntuServer --hence the re-install so that I could apply the kernel-modifications and software layers added by virtualbox.
Does the above make it so that GParted actually works? IDK---havent tested it again. I did however install onto a dynamic VHD --a much larger one.
Furthermore, dont forget that you can mount virtual-hard-disk drives for development and then mount it in Windows for development. I have a particular NTFS VHD that I'm using for MinGW-w64 among other builds that I can mount in windows. To learn more about how to do this check out [Mounting NTFS VHD in Windows].
- How to resize a partition using gparted on Linux
- Resizing EXT3 partition
- How to resize a Virtual Drive
Something to familiarize with GNU/BASH scripting.
Using VI to check your sources list.
- Escape , colon, W, Q (to quit from Vi)
sudo vi /etc/apt/sources.list
# looking for commented universe
# Uncomment `universe` sources and QUIT VI
# check for what needs updating
sudo apt-get check
# upgrade all installed packages with priority on compatibility
sudo apt-get dist-upgrade
see chown options
sudo chown -R USERNAME /var/www
sudo chmod -R 777 /var/www
if [[ -z "$(omeVariable)" ]] {
# ...
}
- from Advanced Bash-Scripting Guide: Chapter 7. Tests: Comparison Options
rm -rf <subdir-name>
Symbolic links are quite significant in pretty-much any operating system you happen to be on.
- One example usage I can think of would be to alias a directory within
/etc/www/html
- Say you have
my-local-repo.git
on your local machine and have checked out the repository on the same machine. For repos that I have which I maintain on the same 'local-machine', I create a symbolic link to amy-checked-out-repo/.git
. Checking out a repository simply clones the repository it self, and synces the master repositry, so this is pretty frigging cool and saves storage space on your machine.
A symbolic link acts like a native file or folder.
Symbolic link on Windows:
Note also that in MSYS we can edit a sort of 'mount' tool in the
/etc/fstab
file, virtually mounting whatever you specify.
:: `MKLINK /?` for help
MKLINK /J "[destination]" "[source]"
Substite (virtual) drive (in windows):
While on the subject of symbolic links on windows, we might as well virtually mount a directory...
:: create virtual-volume
SUBST z: d:/dev
:: remove virtual-volume
SUBST /D z:
Symbolic link on linux:
# See `ln --help` for more information
ln -s '[source]' '[destination]'
So I was pondering the notion of cross-compiling when it had finally occured to me that I could mount a NTFS VHD (that I allready learned how to do in Windows).
- ImDisk (ImageDisk) loads various formats as a Virtual (potentially Removable) Drive in your Windows operating system.
- vmToolkit VHDResizer. Not too shabby.
- Virtual Server 2005 R2 SP1
Yeay, well this really probably doesn't belong here, but there are some stations I want to test, so... I believe that I had installed Streamripper on ubuntu-server (Debian GNU/Linux).
# Rip from a stream:
streamripper URL
# Rip from a stream for one hour:
streamripper URL -l 3600
# Rip the stream, putting the mp3 files into the directory `/my/music/stream1`:
streamripper URL -d /my/music/stream1 -s
# Rip the stream, creating a single file and don´t create individual tracks:
streamripper URL -a -A
# Rip from a stream and create a relay stream at port 9000:
streamripper URL -r 9000
# Rip from a stream, creating a relay stream at port 8000, and allowing twenty clients to connect:
streamripper URL -r -R 20
Invaluable virtual HDD emulator software driver for Windows.
For some reason, I seem to think that a 'properly-partitioned' VHD file done the standard Microsoft way with a VOLUME, and PARTITION table. Note that I am biased towards VHD hdd-images.
ImgDisk is designed to work with RAW HDD image formats.
The following snapshot is from ImDisk Mount tool that comes with ImDisk Toolkit
I've recently discovered that I can mount (non-raw) a guid-partitioned NTFS VHD by using the above tool to mount the 2nd partition, so this would be how you can mount a 'properly partitioned' VHD in windows.
One day I had come across Microsoft Virtual Server 2005 R2 SP1. My Windows 7 Home Ultimate is not supported and basically I didn't waste much time trying to get Virtual Server 05' up and running considering the progress of such projects as VirtualBox and VmWare. Though I never really got to tinkering around with it, I did manage to become familiar with vhdmount.exe
and it has become one of my favorite tools.
With it, basically I've set up a number of VHD files and was able to create and format a partition on such a VHD with ease.
Why is this important?---I mount a 130 Gb (dynamic) NTFS GUID Partition into my ubuntu-server for cross-compiling, and other development. Once I do some compiling, I can mount it in my (non-virtual) Windows 7 and play around with the disk content. Same goes for anything extensive such as web-development files. I like the idea of the NTFS partition that is cross-compatible with my runtime.
- Until yesterday one problem that I've had with ImDisk over the years is in that I've never been able to load a 'properly partitioned and formatted' VHD (see: [loading a non-raw fully partitioned VHD in ImDisk]).
- it is Microsoft software supporting mounting and (properly) formatting and partitioning a (dynamic) VHD file, via a supplied program called
vhdmount
. - I think "1" up there just about covers it. I simply wanted the command-line tools that shipped with this installer.
- VHD files mounted, (GUID) partitioned, NTFS formatted don't mount (at least automatically) in ImDisk.
- However, I have found that a tool based on ImDisk does actually work, so I'm really quite glad, because now I don't really actually need to use the following Microsoft Virtual Server 2005 R2 SP1 to be installed in order to actually load a VHD file in Windows!!!
- It looks like I will still prefer to use Microsoft tools though ;)
- ImDisk has proven quite useful over the years however.
- The reason why I would prefer to use (the following) Microsoft tools is because the disk acts like a traditional HDD and shows up in...
- Run:
%windir%\system32\compmgmt.msc /s
- or Right-Click 'My Computer' and select 'Manage' for the following Computer-Management UI.
- (mmc-snapin) Computer Management -> Storage -> Disk Management
- in the above snap-in we have our default Windows hard-disk manager from which we can format the VHD just like we would do in windows.
- This is my preferred way to create a NTFS VHD (Virtual HDD) that I might use as a development-drive on a virtual linux dev-env: Ubuntu Server (Debian GNU/Linux).
- Run:
- See:
- ImDisk Webpage
- reboot.pro--ImDisk tools
- Get ImDisk Toolkit---This also installs ImDisk (if you so choose). This tool allows me to mount a VHD with GUID partition, NTFS formatted when I select Partition 2 in the UI provided by the "Mount Image File" tool provided in this kit.
- ImDiskAPI: LTR.IO.ImDisk DOTNET Library api-bridge documentation for ImDisk.
- official Virtual Server 2005 SP1 page.
- Virtual Server 2005 R2 SP1: Did Microsoft remove this download?
- FREE: Microsoft Virtual Server 2005 R2 SP1 - Enterprise Edition.
- (description on the download page) Download the service pack 1 for Microsoft Virtual Server 2005 R2 Enterprise Edition. Virtual Server 2005 R2 SP1 is a cost-effective and well supported server virtualization technology for the Windows Server System™ platform. As a key part of any server consolidation strategy, Virtual Server increases hardware utilization and enables organizations to rapidly configure and deploy new servers.
- www.microsoft.com/en-us/search: "Virtual Server 2005 R2"
- www.microsoft.com/windowsserversystem/virtualserver
- DEAD LINK found ^above^: Upgrade to Service Pack 1
- Update for Virtual Server 2005 R2 SP1 Available
- Installing Virtual Server 2005 R2 SP1 on Windows 7 on Ben Armstring's Virtualization Blog
- VHDMount without Virtual Server
Yes, some of these have nothing to do with Ubuntu Server.
- Projects of interest
- Tools of interest
- [ubuntu-openstack]
- SublimeText3 (for non-headless machines)
- Articles of interest
- Cross Compile on Linux
- Sublime Text Package Control: Syncing
- Windows: win-builds.org has such a great package, but it breaks a couple of my projects (especially those I just got working with GTK3).
- This guy must might be the answer to the problems I have with Ruby based Github projects like
github-markup
. - Is kind of funny, I was sort-of thinking about creating linked-directories linking something like
/mingw/i686-w64-mingw32
to/mingw/mingw
. - Will be looking into weather its possible or not to remove specific packages that were automatically installed, or just capture its list of packages that are installed.
- win-builds.org/download
- Win-builds Installation
- This guy must might be the answer to the problems I have with Ruby based Github projects like
- Debian
- virtualboximages/debian+7.0.0+i386
- wiki.debian.org/freedombox/virtualboximages
- No apt-get in OpenSuse (you have to compile it yourself)
- [Install apt-get on OpenSuse]
- http://forums.opensuse.org/showthread.php/477594-apt-get-on-opensuse-12-1
- VirtualBox Disk Image Server: vdi-server.com
- Youtube Tutorials
- John DeVries
- [Ubuntu Web Server from scratch, free web hosting (LAMP, FTP, Webmin, PHPMyAdmin, SSH) [HD]]
- John DeVries
- VirtualBox
The Ubuntu Server Guide is very much like the Debian2 guide.
- Ubuntu Server Guide 14.04
- Introduction
- Installation
- Package Management
- Networking
- DM-Multipath
- Remote Administration
- Network Authentication
- Domain Name Service
- Security
- Monitering
- Web Services
- Databases
- LAMP Applications
- File Servers
- Email Services
- Chat Applications
- Version Control System
- Samba (Windows Networking)
- Backups
- Virtualization
- Control Groups
- Clustering
- VPN
- Other Useful Applications
- Appendix
[Ubuntu Web Server from scratch, free web hosting (LAMP, FTP, Webmin, PHPMyAdmin, SSH) [HD]]: https://www.youtube.com/watch?v=SKJ55ebMcOc [ubuntu-openstack]: http://www.ubuntu.com/cloud/openstack [Install apt-get on OpenSuse]: http://stackoverflow.com/questions/12729673/install-apt-get-on-opensuse [ubuntuserverguide]: http://ubuntuserverguide.com/2012/10/how-to-installing-cms-joomla-3-0-on-ubuntu-server-12-04.html
[GNU/Linux Distribution Timeline3 v12.10]: D:/Horde/mmd-docs/assets/gldt1210.png "GNU/Linux Distribution Timeline"
Footnotes
-
Several versions of Ubuntu Server LTS documents are listed on the page [here][Ubuntu Documentation]. ↩
-
Software in the Public Interest, Inc: Debian Releases — ("https://www.debian.org/releases/") are categorized by release; See: "http://www.debian.org/distrib" –as first found on en.wikipedia.org/wiki/File:Linux_Distribution_Timeline.svg ↩ ↩2
-
image-source gldt1210.svg — futurist.se/gldt ↩ ↩2
-
“How to Enable Intel Virtualization Technology (vt-x) and amd-v in BIOS” – Updated; http://www.sysprobs.com/disable-enable-virtualization-technology-bios by Dinesh @ http://www.sysprobs.com/ ↩
-
Microsoft® TechNet: Microsoft Virtual Hard Disk FAQ — "http://technet.microsoft.com/en-us/bb738381.aspx" ↩