Integrating Ubuntu12.04 into a Java Development Environment -- not just attracting

Source: Internet
Author: User

1. After installing the basic Ubuntu system

1.1 configure source. list

With 163 of the image site, you can access http://mirrors.163.com/view Netease's open source image directory
The following is an example: Delete the original built-in international site and change it to the image site provided by Netease:

+ ---------------------/Etc/apt/sources. list ---------------------------------------------------- +
| Deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse |
| Deb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse |
| Deb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse |
| Deb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse |
| Deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse |
| Deb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse |
| Deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse |
| Deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse |
| Deb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse |
| Deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse |
+ Shards +

1.2 update

After modifying "sources. list", you can immediately run update to update the apt Data source:
Sudo apt-get update

Then we can update the language support and system updates.

You can use the graphic interface. Click system Settings> language support to automatically update the search action. Click the gear in the upper-right corner of the screen (logout/shutdown are all here)-Software Update, the system is automatically updated.

After all the updates are completed, a prompt will be prompted to restart. However, you can delete the old kernel before restarting. If you want to set windows or Mac as the first startup, you can change "grub. cfg" for a long time ".

Delete old kernel:
Sudo apt-get remove linux-header-xxxxxx linux-header-xxxxx.sss linux-image-xxxxxx
Modify the startup sequence:
Sudo vi/boot/grub. cfg
Locate the default value in about 13 rows and set it according to the startup list (memxxxx) below. "0" indicates the first boot guide. <C language array calculation sequence method>


2. Configure the development environment (Java is preferred)

2.1 Browser

After all, it is web-based and can't be left without firebug. Open firefox directly to its website for installation.
Of course, there are necessary plug-ins such as adplus.

Packages.
Download the package and decompress it with tar:
Tar-zxvf xxxxx.tar.gz
The current directory will get a library file flashplugin. so, a description file readme, and a usr directory
Directly Delete the instruction files and usr directories. If you do not need them, it is more troublesome to use them.
Move flashplugin. so to the additional firefox plug-in directory:
Sudo mv xxx/flashplugin. so/usr/lib/mozilla/plugins/

Restart firefox, And the browser will handle it.

2.2 Text Editor

Tend to "(g) vim", of course, gedit is also quite awesome, and jEdit and so on.

Without the vim provided by apt, Mercurial is used to clone the latest vim source code from the vim version repository for compilation and installation. This makes the control and customization more flexible. The latest version often fixes a lot of bugs, so that the troubles encountered by the predecessors will not be met by themselves. For example, the classic gvim-f problem, with the latest gvim version, there is no pressure at all.

Mkdir src
Hg clone https://vim.googlecode.com/hg/ vim
Cd vim/src

* Hg is the version control command of Mercurial. If not, ubuntu will prompt you and tell you how to install it with apt.

Next, compile and set the installation directory to/opt/myVim/to facilitate later upgrade.
Solve vim dependencies first, and use apt-get

Sudo apt-get build-dev vim

* We advocate "vim-gtk", but I get used to it. It may be used in the future.

Then, you can directly modify the "Makefile" configuration before compilation, which is more intuitive:

./Configure -- prefix =/opt/myVim \
-- Enable-multibyte \
-- Enable-pythoninterp \
-- Enable-gui = gtk2 \
-- Enable-fontset \
-- Enable-xim \
-- With-features = huge \
-- With-compiledby = minghuan. mao

* The above parameters are straightforward. Set the installation top-level directory, enable multi-byte encoding, and enable python support (more than 2 ), enable gui and specify the gui library as gtk2 (good compatibility with gtk2), enable external fonts, and enable input methods, compilation is the most characteristic (in fact, this huge does not seem to have to be set to multiple bytes, and so on, but I still set it, and I like to put off my pants and fart ), set who the editor is.

Then compiled:

Make

Finally, install:

Sudo make install

Configure the global initialization variables:

Vi/etc/profile

+ ---------/Etc/profile -------------------------- +
| ~~~~~~~~ |
| Export MYVIM_HOME = "/opt/myVim" |
| $ PATH = "$ MYVIM_HOME/bin: $ PATH" |
| ~~~~~~~~~~~~~ |
+ ------------------------------------------------- +

After the change, log out of the desktop system and the environment variables will take effect. You don't have to restart the system, so you don't have to worry about it.

Finally, create a "vimrc" under "/opt/myVim/share/vim/", configure vim globally, or create a file in your home directory. vimrc only configures itself.
Create a. vim directory in your home directory so that the vim plug-in can be directly thrown here. It is better to put the plug-in your own directory.

* Recommended plug-in: autocomplete matchit zen-coding taglist txtbrowser...

In addition, if you are not very familiar with vimrc, go to github, sourceforge, googlecode, and so on. There are a lot of sample versions, and you will try again.

OK. So far, vim has been installed and can be used, but it is uncomfortable because there is no starter on unity and Gvim cannot be found when searching applications.

In this way, the Unity search application will find "~ /. Local/share/applications/"directory, create a gvim. desktop starter here.

Vim ~ /. Local/share/applications/gvim. desktop

Example:

+ ------- Gvim. desktop -------------------------------------- +
|
| [Desktop Entry] |
| Name = Gvim |
| Comment = Gvim |
| Exec =/opt/myVim/bin/gvim |
| Icon =/home/rock/. vim/vim48x48. xpm |
| Type = Application |
| Categories = Application; Development; |
|
+ ----------------------------------------------------------- +

* Pay attention to the Icon setting "Icon =/home/rock /. vim/vim48x48. xpm ", this vim48x48. xpm is actually copied from the runtime directory under the source code directory cloned with hg. in the vim directory.

Now, you can search for the Application Gvim in Unity, and Gvim will appear. Start it and lock it to the dock bar.

* Extra suggestion: in fact, Ubuntu has a good font, which is called Ubuntu/Ubuntu mono. I am a laptop and have a screen of 14. I don't feel it is necessary to set guifontwide. I directly set guifont to use the Ubuntu Mono font at the same width as 12, which is quite nice to understand in Chinese and English.

 

2.3 JDK installation and configuration

This is simpler. Download the jdk binfile directly from the official website.

* I have never used OpenJDK, nor "apt-get install jdk", because the installation seems too messy. Originally, Linux applications are green and environmentally friendly, jdk must be scattered in various "standard" directories. It is important that I compile and install flexible programs because prefix ~~~~ can be specified ~~~~

The binfile of jdk can be decompressed by itself, giving it an execution permission, and then executing the self-decompressed command to the current directory:

Chmod u + x jdkxxxxxxxxxxxx. bin
./Jdkxxxxxxxxxxxx. bin

After the jdk is decompressed, it will automatically open my browser to their website and clean it.

Directly go to/opt. I usually put the compiled and installed public programs here:

Cd/opt
Sudo mv xxx/jdk1.6.0 _ 33.

Check whether the jdk directory owner is root. If not, change it to root.

Sudo chown-hR root: root jdk1.6.0 _ 33

Then modify the global variable initialization file/etc/profile, as in vim:

Sudo vim/etc/profile

Example:
+ ---------/Etc/profile add -------------------- +
|
| Exprot JAVA_HOME = "/opt/jdk1.6.0 _ 33" |
| PATH = "$ JAVA_HOME/bin: $ PATH" |
|
+ ------------------------------------------------ +

Log out of the system and log in again. Open the console and test java-version. If you don't need to test it, you must have it.

Now, the jdk environment is configured.


2.4 install and configure Eclipse EE

First, as a java developer, you can try to install eclipse through apt ~~
This is much simpler than jdk, and it is still the same. You can download the linux version of Eclipse for EE from the official website.

Then, go to the/opt directory and extract the tar.gz file of eclipseto the directory.

Cd/opt
Sudo tar-zxvf xxx/eclipsexxxxxx.tar.gz
Sudo mv eclipse Eclipse_EE_Juno

I renamed the eclipse directory Eclipse_EE_Juno to look pleasing to the eye.

Of course it can be used now, but I am used to making changes:

Sudo groupadd eclipse
Sudo chown-hR root: eclipse Eclipse_EE_Juno
Sudo chmod-R g + rw Eclipse_EE_Juno
Sudo gpasswd-a my username eclipse

Okay, a series of actions will actually create a new group named eclipse. Then, change the owner of the Eclipse_EE_Juno directory and sub-directories and sub-files to root, and change the holding group to the newly created eclipse group;
Then grant the owner group of Eclipse_EE_Juno the permission to write it and its sub-directory file;
Finally, add me to the eclipse group so that I have all the operation permissions for Eclipse_EE_Juno.
Of course, these settings will take effect only after cancellation.

Another thing is to configure the eclipse starter ~ /. Local/share/applications/. In this way, you can search for Eclipse by using Unity's search application function.

Vim ~ /. Local/share/applications/Eclipse. desktop

Example:
+ --------- Eclipse. desktop sample -------------------- +
|
| [Desktop Entry] |
| Name = Eclipse |
| Comment = Eclipse_EE_Juno |
| Exec =/opt/Eclipse_EE_Juno/eclipse |
| Icon =/opt/Eclipse_EE_Juno/icon. xpm |
| Type = Application |
| Categories = Application; Development; |
|
+ --------------------------------------------------- +

Then go to the Unity search function and check whether it is available. Start it and lock it to the dock, and Eclipse will fix it.

* It is recommended that you configure eclipse. ini to improve Eclipse efficiency ~~~

* I have nothing to say about the font. You don't need to configure gtk. Try the Ubuntu Mono font ~


2.5 Tomcat installation and configuration

First of all, as a java web Developer, I strongly oppose the apt installation of tomcat. You are not a server administrator. You will often abuse tomcat during the development process ~~
For installation and configuration of eclipse, download the tar package of tomcat from the official website and decompress it to the/opt directory.

Cd/opt
Sudo tar-zxvf xxx/apache-tomcat.tar.gz
Sudo groupadd tomcat
Sudo chown-hR root: tomcat apache-tomcat
Sudo chmod-R g + rw apache-tomcat
Sudo gpasswd-a my username tomcat

This is done ~

* Extra suggestion: I always see some articles that use chmod 777 xxxx directly when configuring tomcat...


2.6 install MySQL

I used to like bin packages and installation scripts on the official website. I thought about it later. I am not a professional database administrator. I am just a developer, unlike jdk, vim, eclipse, and tomcat are flexible tools.
In short, a command:

Sudo apt-get install mysql-client mysql-server

Oh, hand it over to the Ubuntu software manager.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.