📜 ⬆️ ⬇️

PhpStorm in Ubuntu 14 using in Windows 7 via Xming

There was a problem of smooth migration from a Windows workstation to Ubuntu. Since nobody canceled the execution of basic operations using a computer, the migration has to be done in chunks, leaving the familiar environment (Windows 7 x64) accessible. Since I am a developer, the first thing to do is to transfer the IDE (in my case, PhpStorm). The virtual host hamster , working under Ubuntu, was chosen as the target machine for migration, on which our projects are tested.

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.1 LTS Release: 14.04 Codename: trusty $ uname -a Linux hamster 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 1 

Install PhpStorm


Go to the virtual host hamster via SSH, load the IDE and unpack:

 $ wget http://download-cf.jetbrains.com/webide/PhpStorm-8.0.2.tar.gz $ tar -zxf PhpStorm-8.0.2.tar.gz $ ls -lh total 124M drwxrwxr-x 7 ag ag 4.0K Dec 19 16:56 PhpStorm-139.732 -rw-rw-r-- 1 ag ag 124M Dec 10 16:50 PhpStorm-8.0.2.tar.gz 

Install Java according to the instructions from JetBrains :
')
 $ sudo apt-get purge openjdk* $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer 

Check the Java installation, go to the IDE bin-files and run the application:

 $ java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) $ cd PhpStorm-139.732/bin/ $ ./phpstorm.sh Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0 Exception in thread "main" java.awt.HeadlessException: Unable to detect graphics environment No X11 DISPLAY variable was set, but this program performed an operation which requires it. at com.intellij.idea.Main.main(Main.java:63) 

Well, yes, the graphical application does not start through the text terminal.

Installing Xming and connecting to a virtual host


Install Xming on a working Windows machine and run:

 >"C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow 

I have PuTTY on my local machine, so we set up a session to work with hamster via PuTTY. Highlight:
image

Install a new session through PuTTY and check the availability of X:

 $ echo $DISPLAY localhost:10.0 

Go to the bin folder deployed to the hamster IDE and run the application:

 $ cd ~/PhpStorm-139.732/bin/ $ ./phpstorm.sh Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0 Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit at java.awt.Component.<clinit>(Component.java:593) at com.intellij.idea.Main.showMessage(Main.java:221) at com.intellij.idea.Main.showMessage(Main.java:208) at com.intellij.idea.Main.main(Main.java:81) 

Again, failure, not enough X11-server on hamster 'e.

X11 Deployment


Open a separate SSH session to install and run X11.

 $ sudo apt-get install xorg $ sudo startx & 

Go back to the X11 session and try running phpstorm again:

 $ ./phpstorm.sh Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0 PuTTY X11 proxy: wrong authorisation protocol attemptedException in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment at java.lang.Class.forName0(Native Method) ... 

I do not know what actually needs to be tweaked further, but Google issues recommendations that come down to the following commands (I performed in the new X11 session, but maybe it will also pass in the already installed one):

 $ xauth list hamster/unix:10 MIT-MAGIC-COOKIE-1 668c9a37a292b40b3e243ebad33b5955 $ xauth add hamster/unix:10 MIT-MAGIC-COOKIE-1 668c9a37a292b40b3e243ebad33b5955 

Start PhpStorm from the X11 session again:

 $ cd ~/PhpStorm-139.732/bin/ $ ./phpstorm.sh 

As a result, we have started the process of configuring IDE PhpStorm running on a remote Ubuntu host, but managed on a local Windows machine:



After the final deployment of IDE PhpStorm on a remote Ubuntu host, we can start developing our projects without leaving our familiar Windows environment:

Source: https://habr.com/ru/post/246357/


All Articles