A Lubuntu virtual machine on VMWare Player is currently one of my standard tools for developing and testing software. I had a Hard Time (c) the first time I installed and fully configured such an instance because I was (suspense, suspense…) behind a proxy! The need for this setup has been triggered by the fact that I like my VMWare machines to be able to resize the desktop as I resize the VMWare window that contains them. That feature is available in most Linux distros only if you install the VMWare-tools package on the guest machine. That, in turn, requires the build-essential package (gcc, make, and the like).
Here’s the outline:
- set the system-wide proxy;
- tell apt to use the proxy (’cause no, it won’t use the fucking system proxy);
- update and upgrade apt;
- install build-essential with apt-install;
- install VMWare-tools.
Now that I read it, it seems like an easy thing to do, but it took me some time to have all the pieces set up, so I guess it’s worth to write a brief tutorial to share what I have learned. Of course, I did not find out all these things by myself: this a just a summary of the knowledge that I gathered from the Internet (thank you, Internet).
1. Set the system-wide proxy.
Interestingly, Lubuntu does not have a nice GUI to let you set the proxy, so you have to do it some other way. For me, the best way is to just set the appropriate variable inside the /etc/environment file, so that it is shared across all users. Since it is going to be a development box I do not care about which user logs in at all. I just want the variable available and I want it fast.
to do that, open the aforementioned file with:
sudo nano /etc/environment
or with your favourite text editor (I am sorry if it’s vim), and make sure that the following lines are added:
http_proxy=http://22.214.171.124:3456 https_proxy=http://126.96.36.199:3456 ftp_proxy=http://188.8.131.52:3456 no_proxy="localhost,127.0.0.1"
(As you might imagine, you have to replace the fake IP addresses and ports with your proxy’s ones). To make the change effective you must log out and log in again.
2. Tell apt to use the proxy.
Because otherwise it won’t. Open the file /etc/apt/apt.conf for edit. If it does not exist, create it. Add the following lines:
acquire::http::proxy "http://184.108.40.206:3456" acquire::https::proxy "https://220.127.116.11:3456" acquire::socks::proxy "socks://18.104.22.168:3456" acquire::ftp::proxy "ftp://22.214.171.124:3456"
again, replace the “101” and “3456” placeholders with your actual addresses and ports, and save it.
3. update and upgrade apt.
Run the following command to make apt up to date:
sudo apt-get update sudo apt-get upgrade
4. Install build-essential with apt-install.
Now you are ready to use apt commands behind your proxy. Type
sudo apt-get install build-essential
to install the necessary build tools.
5. Install VMWare-tools
Now that you have all the prerequisites, you are ready to install the VMWare-tools. Select the menu item as in the picture below, follow the instructions that VMWare Player prompts to you, and you should be fine.