Welcome, Guest. Please login or register.

Author Topic: NXT for Linux Instructions (Ubuntu)  (Read 501 times)

0 Members and 1 Guest are viewing this topic.

Offline barbarosinciler

  • Fresh Nxter
  • *
  • Posts: 5
    • View Profile
NXT for Linux Instructions (Ubuntu)
« on: December 08, 2013, 02:38:10 PM »
Here is the guide to install NXT client on linux 64-bit platform. I've chosen the ubuntu distro because it's the most common one. You can use this instructions on your linux vps as well. 32-bit instructions are similar, only you need to download and install the x32 version of java-jre.

1 - Setting up Java JRE

1.1 - First, we need the latest java jre in your system. To do that:
type the following command to a terminal to delete the existing java in your system:
Code: [Select]
sudo apt-get purge openjdk-\*
1.2 - then create a directory to hold jre files with this command:
Code: [Select]
sudo mkdir -p /usr/local/java
1.3 - then go to this folder, download the latest (1.7.0-45 for today) jre and extract the tarball:
Code: [Select]
cd /usr/local/java
sudo wget http://ghaffarian.net/downloads/Java/JRE/jre-7u45-linux-x64.tar.gz
sudo tar xvzf jre-7u45-linux-x64.tar.gz

1.4 - now you need to add the PATH variables to our system:
open a nano editor with this command:
Code: [Select]
sudo nano /etc/profileScroll down to the end of the file using your arrow keys and add the following lines (copy/paste) below to the end of your /etc/profile file:
Code: [Select]
JAVA_HOME=/usr/local/java/jre1.7.0_40
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
save the file and exit with ctrl+x and yes

1.5 - now you need to inform your Ubuntu Linux system where your Java JRE is located, and make it default with these commands. execute each of them one by one:
Code: [Select]
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_45/bin/java" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre1.7.0_45/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jre1.7.0_45/bin/java
sudo update-alternatives --set javaws /usr/local/java/jre1.7.0_45/bin/javaws

now you should have succesfully installed the latest jre to your system.

2 - Installing and running NXT Client

2.1 - you should download the latest nxt client. you can check them from this post: https://nextcoin.org/index.php/topic,100.msg730.html#msg730
cd your home folder and download the latest client:
Code: [Select]
cd ~
wget https://dl.dropboxusercontent.com/u/67242472/nxt.zip

2.2 - then unzip it:
Code: [Select]
unzip nxt.zip
cd nxt

2.3 - now it's time to start the client. start it with following command:
Code: [Select]
java -jar start.jar
you can open http://localhost:7875 or http://localhost:7674 from a browser for GUI. If you've installed the client to a vps, you should change the "localhost" with your vps ip.

3 - (OPTIONAL) Setting up client to run when computer starts

3.1 - To automate the starting process of client, you need a startup script. to make it type the following commands to terminal:
Code: [Select]
cd ~
sudo nano ~/startup.sh
now copy and paste the following lines to your script:
Code: [Select]
#!/bin/bash
cd ~/nxt/
java -jar start.jar

3.2 - you should add this script to your startup with crontabs. type
Code: [Select]
crontab -eand select nano as editor, add this line at the end of file:
Code: [Select]
@reboot ~/startup.sh
Donations: 17449290204457266561
NXT: 17449290204457266561

Offline hob

  • Fresh Nxter
  • *
  • Posts: 15
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #1 on: December 08, 2013, 04:30:55 PM »
Quote
1.1 - First, we need the latest java jre in your system. To do that:
type the following command to a terminal to delete the existing java in your system:
Code: [Select]
sudo apt-get purge openjdk-\*
Not a good idea to purge all JREs, some packages or other software may have dependencies on it. You don't need to uninstall any JRE if done properly. Furthermore, if you already have Java 7 / OpenJDK 1.7 installed you don't need to change anything.

Quote
1.2 - then create a directory to hold jre files with this command:
Code: [Select]
sudo mkdir -p /usr/local/java
Unnecessary, there are openjdk-7-jre packages, see http://packages.ubuntu.com/search?keywords=openjdk-7-jre, there's also no need to edit environment variables if installed properly. Simply install it with
Code: [Select]
sudo apt-get install openjdk-7-jre
Quote
1.3 - then go to this folder, download the latest (1.7.0-45 for today) jre and extract the tarball:
Code: [Select]
cd /usr/local/java
sudo wget http://ghaffarian.net/downloads/Java/JRE/jre-7u45-linux-x64.tar.gz
sudo tar xvzf jre-7u45-linux-x64.tar.gz
Why trust some arbitrary stuff from some unknown location to be installed in the system?

Quote
1.5 - now you need to inform your Ubuntu Linux system where your Java JRE is located, and make it default with these commands. execute each of them one by one:
Code: [Select]
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_45/bin/java" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre1.7.0_45/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jre1.7.0_45/bin/java
sudo update-alternatives --set javaws /usr/local/java/jre1.7.0_45/bin/javaws

Code: [Select]
sudo update-alternatives --config javaand pick the one with java-7
NXT: 4073743616493625357
I'll be happy about donations and say thank you :)

Offline hob

  • Fresh Nxter
  • *
  • Posts: 15
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #2 on: December 08, 2013, 04:36:50 PM »
Quote
You can use this instructions on your linux vps as well.
Quote
If you've installed the client to a vps, you should change the "localhost" with your vps ip.

https://nextcoin.org/index.php/topic,4.0.html explicitly says
Do NOT run Nxt on a VPS.  Only run Nxt locally.  Even if you connect to your VPS securely via SSH, you are still not safe because all VPSs have backdoors.
NXT: 4073743616493625357
I'll be happy about donations and say thank you :)

Offline Jean-Luc

  • Original Stakeholders
  • Fresh Nxter
  • *
  • Posts: 18
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #3 on: December 08, 2013, 05:25:23 PM »
If you use Ubuntu, the easiest way to install Oracle Java is to use the webupd8 repository:
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
Code: [Select]
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
Then you will also get updates to it automatically, as with all other ubuntu packages.

It is ok to run Nxt on a VPS, as long as you never unlock your account there. But you can (and you should, if you are a large stakeholder) hallmark the node, so that it contributes to the stability of the network.
https://bitcointalk.org/index.php?topic=345619.msg3864274#msg3864274

Again, if you are using a VPS, you have a public IP. Do everyone a favor and announce that IP, by editing nxt/webapps/root/WEB-INF/web.xml and putting it there:
Code: [Select]
<init-param>
<param-name>myAddress</param-name>
<param-value>PUT.YOUR.IP.HERE</param-value>
</init-param>

Depending on how much memory the VPS has, add a -Xmx command line parameter to increase the memory available to java. Use about 75% of your total memory (unless you run other things on that server too). If you have 2GB ram, you can run:
Code: [Select]
nohup java -Xmx1536M -jar start.jar &
(I use nohup so that it continues running even after I logout from the VPS).

If you encounter performance problems, out of open files errors, see the discussion here for tcp parameters and open files limits to adjust:
https://bitcointalk.org/index.php?topic=345619.msg3875822#msg3875822

Finally, the original post apparently suggests running Nxt as root. This is never a good idea. Create a unix user nxt, and use this account for running Nxt (and nothing else).

« Last Edit: December 08, 2013, 05:31:16 PM by Jean-Luc »
BTC: 1NSaJp4zwM1deJ6MTbGBXtMZSGB2iMY1CA

Offline JohnyCrypt

  • Nxter
  • **
  • Posts: 104
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #4 on: December 09, 2013, 02:38:32 PM »
Depending on how much memory the VPS has, add a -Xmx command line parameter to increase the memory available to java. Use about 75% of your total memory (unless you run other things on that server too). If you have 2GB ram, you can run:
Code: [Select]
nohup java -Xmx1536M -jar start.jar &
(I use nohup so that it continues running even after I logout from the VPS).

Thanks for this part. I was wondering if allocating more memory was making any difference (running with -Xms1024m -Xmx2048m with 8GB).
BitCoinTalk Verification: https://bitcointalk.org/index.php?topic=356307.msg3811732#msg3811732
NXT:13726890115391643239

Offline opticalc

  • Global Moderator
  • Established Nxter
  • *****
  • Posts: 198
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #5 on: December 09, 2013, 05:54:19 PM »
OP, thanks much for this guide.  Can you update it with the suggestions in the thread please?  We'd like to get it translated to the other language boards.  Let me know when you think its ready.
Verify token for acct 12692935506199079028 https://127.0.0.1:7875/nxt?requestType=decodeToken&website=opticalc&token=itsjamfi622t2dk5bmodmcaasm3qm3cfisifu44hbjk58vsa3apnm28k60r7jt00afme9ak8j9jq82vub0mbcocbvmf653jhvgdboda9va900t3t5gv9edvofsg5vcuq611rp8nmbb1rm908fll59juus501oqh6

Offline JohnyCrypt

  • Nxter
  • **
  • Posts: 104
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #6 on: December 10, 2013, 06:10:42 PM »
Any spaces or syntax problems with the ip value? I've never seen that come up when I put my IP in. Are you putting in your public facing IP?

If you can post your web.xml myAddress section it would help.
BitCoinTalk Verification: https://bitcointalk.org/index.php?topic=356307.msg3811732#msg3811732
NXT:13726890115391643239

Offline ferment

  • Fresh Nxter
  • *
  • Posts: 42
  • nxt ops
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #7 on: December 11, 2013, 02:07:15 AM »
Also for those that run into this error:

Code: [Select]
java.io.IOException: Too many open files

You can update your open file limits following this guide:
http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/#Linux

This one was a pain to get right as most search results left on the change to sshd_config.
nxtbase: node management tools and public nodes
donate nxt: 11243542237777034551

Offline crackerhead

  • Fresh Nxter
  • *
  • Posts: 12
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #8 on: December 11, 2013, 05:57:15 AM »
I am unable to install with these instructions, I2013-12-10 19:51:09.430:INFO:oejs.ServerConnector:main: Started  get to the last step, and when I try to run the java client, I get stuck here:
ServerConnector@62ad2701{SSL-http/1.1}{0.0.0.0:7875}

I try to run the GUI from my browser, but it doesn't connect to anything. I am not too worried about having access to my NXT right now, but I just want to make sure that my NXT will be in my wallet when I finally do get access to it.

Basically I have some NXT being transferred from DGEX, and I just want to make sure that I don't need to login to my NXT wallet in order for the transaction to go through, thanks for the help!
NXT:8383521195067531696

Offline JohnyCrypt

  • Nxter
  • **
  • Posts: 104
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #9 on: December 11, 2013, 05:27:04 PM »
I am unable to install with these instructions, I2013-12-10 19:51:09.430:INFO:oejs.ServerConnector:main: Started  get to the last step, and when I try to run the java client, I get stuck here:
ServerConnector@62ad2701{SSL-http/1.1}{0.0.0.0:7875}
That's my last notification at startup as well. Make sure you're going to https://localhost:7875 or if this machine is not local, go to https://<insertyouriphere>:7875

Don't forget it's https, not http for port 7875. Also check your firewall and make sure it's allowing outbound 7875 for web and 7874 for P2P communication.
BitCoinTalk Verification: https://bitcointalk.org/index.php?topic=356307.msg3811732#msg3811732
NXT:13726890115391643239

Offline crackerhead

  • Fresh Nxter
  • *
  • Posts: 12
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #10 on: December 11, 2013, 08:30:02 PM »
Im getting closer, I was able to get to https://localhost:7875, but get these kind or errors at terminal:

   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
   at java.lang.Thread.run(Thread.java:744)
2013-12-11 10:26:20.385:WARN:oejs.HttpChannel:qtp1332782448-36: Could not send response error 500: java.lang.IllegalStateException: s=DISPATCHED i=false a=null

And get this familiar javascript output, I have seen other people with this issue, I will look around the forums for some more help, THANKS!!

java.lang.NullPointerException
NXT:8383521195067531696

Offline crackerhead

  • Fresh Nxter
  • *
  • Posts: 12
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #11 on: December 11, 2013, 09:03:18 PM »
Im getting closer, I was able to get to https://localhost:7875, but get these kind or errors at terminal:

   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
   at java.lang.Thread.run(Thread.java:744)
2013-12-11 10:26:20.385:WARN:oejs.HttpChannel:qtp1332782448-36: Could not send response error 500: java.lang.IllegalStateException: s=DISPATCHED i=false a=null

And get this familiar javascript output, I have seen other people with this issue, I will look around the forums for some more help, THANKS!!
java.lang.NullPointerException

I restarted computer and reinstalled nxt files, now it works, THANKS AGAIN!!!!
NXT:8383521195067531696

Offline JohnyCrypt

  • Nxter
  • **
  • Posts: 104
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #12 on: December 11, 2013, 09:50:07 PM »
Im getting closer, I was able to get to https://localhost:7875, but get these kind or errors at terminal:

   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
   at java.lang.Thread.run(Thread.java:744)
2013-12-11 10:26:20.385:WARN:oejs.HttpChannel:qtp1332782448-36: Could not send response error 500: java.lang.IllegalStateException: s=DISPATCHED i=false a=null

And get this familiar javascript output, I have seen other people with this issue, I will look around the forums for some more help, THANKS!!
java.lang.NullPointerException

I restarted computer and reinstalled nxt files, now it works, THANKS AGAIN!!!!
Awesome, glad it worked!
BitCoinTalk Verification: https://bitcointalk.org/index.php?topic=356307.msg3811732#msg3811732
NXT:13726890115391643239

Offline ben

  • Nxter
  • **
  • Posts: 65
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #13 on: December 12, 2013, 01:23:58 AM »
i have problems getting 0.3.18 working....

0.3.16 working fine in linux



0.3.18....after first start i try CTRL-C (but not working!!!)
On first CTRL-C it should write new blockchain.nrs format!
But i doesn't....

any help? i am back to 0.3.16 now!
----
THANK YOU for donating some NXT @   8707785682971074378
for keeping my well-known-node up and running

Offline JohnyCrypt

  • Nxter
  • **
  • Posts: 104
    • View Profile
Re: NXT for Linux Instructions (Ubuntu)
« Reply #14 on: December 12, 2013, 03:33:33 AM »
i have problems getting 0.3.18 working....

0.3.16 working fine in linux



0.3.18....after first start i try CTRL-C (but not working!!!)
On first CTRL-C it should write new blockchain.nrs format!
But i doesn't....

any help? i am back to 0.3.16 now!
I'm not having any issues with stopping the client. The ctrl-c works fine for me. The only thing I can think of is I put the full path to to my blockchain.nrs file (which isn't in the nxt directory). Not sure if that helps or not.
BitCoinTalk Verification: https://bitcointalk.org/index.php?topic=356307.msg3811732#msg3811732
NXT:13726890115391643239