Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Use Vagrant build cross-platform development environment for Python     - C language macro definition #define Usage (Programming)

- Linux loopback adapter Driven Design (Programming)

- Zookeeper Rights Management and Quota Management (Server)

- Android thread mechanism --AsyncTask (Programming)

- How to install GIMP 2.8.16 in Ubuntu 16.04,15.10,14.04 (Linux)

- The Objects in JavaScript (Programming)

- Repair fatal error in Linux: lame / lame.h: No such file or dir Error (Linux)

- Install Java JDK 8 in CentOS 7 / 6.5 / 6.4 (Linux)

- VMware virtual machine to install CentOS 7 (Linux)

- Using Oracle for Oracle GoldenGate to achieve a one-way data synchronization (Database)

- Hackers is how the invasion and control of Things devices? (Linux)

- Read and write files efficiently from Apache Kafka (Server)

- How screenshots from the Linux command line (Linux)

- Java JDK has been able to compile without warning (Programming)

- Linux environment variable settings and save places (Linux)

- GCC and gfortran write MEX program (Matlab2012a) under Ubuntu 14.04 (Programming)

- Oracle archive log full cause abnormal slow database performance (Database)

- Security of data to create a safe .mdb database (Linux)

- Configuring xdebug debugging environment in Ubuntu 14.04 under the PhpStorm (Linux)

- MyCAT separate read and write to achieve MySQL Practice (Database)

 
         
  Use Vagrant build cross-platform development environment for Python
     
  Add Date : 2017-08-31      
         
       
         
  Recently upgraded after Win10 Meng Meng da sensory system, but also a pity that his own before spending a lot of effort to build a development environment. Due to the recent demand for cross-platform is relatively large, consider building a cross-platform development environment.

Vagrant

Vagrant is a relatively lightweight virtual machine management software, according to the official description:

(Vagrant) Create and configure lightweight, reproducible, and portable development environments.

Vagrant so chose to manage the development environment. Vagrant download and installation is very easy, you can download the required version on its official website https://www.vagrantup.com/downloads.html in.

Virtual Box

Vagrant itself does not contain virtual machine management software, so we need to meet Vagrant install a virtual machine software. Vagrant supports VMware, Virtual Box, Hyper-V and other virtual machine software, I chose Virtual Box. Free, cross-platform.

Virtual Box is also very easy to install, you can download the official website, this will not go into details.

Tips: Why have a virtual machine software also need to use Vagrant?

Because of easy virtual machine does not meet our needs, we want a new environment, the boot to help us solve everything. Use Vagrant can easily help us build the system after the automatic port mapping management / package installation and so on.

At the same time, more importantly, Vagrant you can easily set the sync folder, let us modify the program in the host, you can easily synchronize to the client, in the debugger, which is a very good character.

Select the client system

Vagrant clients can support a variety of systems, specifically to support those, you can go https://atlas.hashicorp.com/boxes/search view, I chose Ubuntu 14.04 x64 version, which is https: //atlas.hashicorp .com / ubuntu / boxes / trusty64 this version.

If you have no other needs, just we need a clean ubuntu, After selecting a folder in the Executive vagrant init ubuntu / trusty64 can initialize a Ubuntu 14.04 x64 virtual machine.

At this folder will appear in a Vagrantfile file is the client configuration files.

Modify the configuration file

Modify the configuration file has two main purposes, first configure port mapping, so that we can go to access the client from a host port, another object is to enable the client to perform a Shell script when the system load is complete to install the program needed file.

Vagrant will default initialize a port mapping for the guest: 22, host: 2222 That is 22 port on the client will be mapped to host the 2222 port.

Modify port mapping

We have found in the file Vagrantfile

# Config.vm.network "forwarded_port", guest: 80, host: 8080
This line, remove the # sign, and according to our need to modify the port, I set as follows:

config.vm.network "forwarded_port", guest: 5000, host: 15000
This sets the client host to forward port 5000 to port 15000, or 15,000 ports will be forwarded to the host port 5000 client.

Loading configuration scripts

Vagrant can set up a configuration script to help us to set the configuration: Locate

  # Config.vm.provision "shell", inline: < < - SHELL
  # Sudo apt-get update
  # Sudo apt-get install -y apache2
  # SHELL
These lines will be amended to

  config.vm.provision "shell", path: "python_env.sh"
After the show first started, you will find python_env.sh and executed. We can set this script to complete the configuration of different environments, my configuration is as follows:

echo "--------------------- Upgrading System ......---------"
sudo rm -R / var / lib / apt / lists / *
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get build-dep python
echo "--------------------- Upgrading System ......---------"
wget -c https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -xzvf Python-2.7.9.tgz
cd Python-2.7.9 /
LDFLAGS = "- L / usr / lib / x86_64-linux-gnu" ./configure
make
sudo make install
echo "--------------------- Checking Installation -----------"
python --version
echo "--------------------- Setting pip ---------------------"
sudo apt-get install build-essential
sudo apt-get install python-dev
sudo apt-get install python-pip -y
echo "--------------------- Upgrading pip -------------------"
sudo pip install --upgrade pip

start up

After doing all this, we will be able to start the client. Executive vagrant up in the directory

Configuration environment, we can see already in the implementation of Shell scripts, update your system. This time only need to wait quietly like ...

start using

Vagrant will be created after the start for us a Private Key for login, you can enter vagrant ssh directly in the Windows command line to SSH operations to be like me, you use other clients. I use MobaXterm as SSH Client Windows under.

After entering, you can enter into the development environment.

Synchronize folders

Might enter cd / vagrant and ls in the terminal, what do you see?

Yes, python_env.sh and Vagrantfile we created in Windows appears on the client. This is a synchronized folder. The folder and the corresponding Windows folder synchronization.

Thus, we can easily carry out the operation in a virtual machine.
     
         
       
         
  More:      
 
- Changes in C # asynchronous programming model (Programming)
- Windows environment Android Studio v1.0 Installation Guide (Linux)
- Linux system security configuration (Linux)
- Defensive programming in PHP (Programming)
- Linux uses a screen recording under RecordMyDesktop (Linux)
- Why you should choose Python Programming (Programming)
- Spark SQL job of a lifetime (Server)
- VMware6 achieve nat Internet (Linux)
- JavaScript common array manipulation functions and usage (Programming)
- Use ISO document production OpenStack used CoreOS mirror (Linux)
- Binder began to talk about inter-process communication mechanism from Android AIDL (Programming)
- Ubuntu 14.04 set auto sleep time (Linux)
- Install the free open source financial software GnuCash 2.6.6 under Ubuntu (Linux)
- Do not find ifconfig eth0 and IP address under CentOS6.5 (Linux)
- Elasticsearch 2.20 Highlight (Server)
- Java garbage collection (Programming)
- Android Dynamic efficiency articles: a brilliant Loading Analysis and Implementation (Programming)
- Oracle 11g dataguard main library backup and recovery to the test environment in one database error (Database)
- CentOS iptables firewall configuration (Linux)
- 8 Git tips (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.