Python pip without internet

The title of this post is a bit misleading. I will not outline the use of pip without internet but I will suspect most people will search for this search string, thus coming here for an alternative.

I’ve been blessed with a very thorough security officer, who decided that CLI internet access is not permitted, even using CNTLM (1)is blocked.

The easiest way to install packages is via pip, but it’s also possible to install them via the commandline.

Using the example of Django, we will first download the tarball from the Django site;

https://www.djangoproject.com/download/

On the right side there’s a link to the latest release.

Unzip and untar the tarball and open a Prompt in that directory.

Then run the following command:

python setup.py install

Next, we’ll check if it is installed correctly:

2015-10-20 13_11_27-Opdrachtprompt

Can not connect to Virtualbox Guest Oracle Database 12c Developer Day Database VM due to Oracle Linux firewall

It seems there’s a firewall present on the latest Developer Days Database image which I’ve just downloaded from Oracle.

Description:

I enjoy using these images because it is a complete reference install of Oracle Linux, Oracle Database and Oracle SQL Developer (among others). Besides that, it only takes 10 minutes to setup a base install from the image.
Usually I like to connect from my local SQL Developer instead of the one inside the VM.

Problem:

But with this setup I could not connect when I added the NAT Port Forwarding in Virtualbox, it timed out when trying to connect. I could connect from the SQL Developer inside the VM, just not through the NAT port which was forwarded (important: see the bottom of this post to check the NAT Port Forwarding settings in Virtualbox)

Solution:

It’s fairly easy to add a firewall rule which allows access to port 1521 on Oracle Linux, we can even do it with a GUI:

Select Menu “System” – “Administration” – “Firewall”

Screenshot from 2014-08-19 12:55:14Then follow these steps:

  1. Click [Other Ports]
  2. Click [Add]
  3. Select [User Defined]
  4. Enter Port: “1521”
  5. Select Protocol: “TCP”
  6. Click [Apply]
  7. Click [Reload]

Screenshot from 2014-08-19 12:55:55

 

You’ve just added port 1521 to the iptables which makes it okay to connect to this port from another IP outside the local machine.

We can test from SQL Developer, running on the Host:

Oracle SQL Developer : Local - Sys_009

 

And it works! :-)

 

Extra: NAT Port Forwarding in Virtualbox

Just to be sure, these are the settings you’ll need to set inside the Virtualbox Manager to setup the port forwarding on port 1521 from the guest to the host:

Select the “Settings” of the Developer Day VM and then:

  1. Select “Network”
  2. Click [Port Forwarding]

OTN Developer Day VM_1 - Settings_012

 

Then in the Port Forwarding Rules:

  1. Enter a descriptive name: “DB”
  2. Enter the host port: “1521”
  3. Enter the guest port: “1521”

OTN Developer Day VM_1 - Settings_011