solana-developers / solana-cookbook

https://solanacookbook.com/
607 stars 340 forks source link

Persisting the Solana command on Linux (Ubuntu) #525

Open litmus-zhang opened 1 year ago

litmus-zhang commented 1 year ago

After downloading and extracting solana-cli binaries on my machine (Ubuntu 20.04 and 22.04), when i open a new terminal, i cannot access the solana command.

litmus-zhang commented 1 year ago

@litmus-zhang working on this

Sarvesh-Ghildiyal commented 9 months ago

Hello there, Did you added the path to your binaries to your system path variables?

export PATH=$PATH:/path/to/solana/bin change the "/path/to/solana/bin" to the actual path of your folder.

and then reload the shell to implement the changes made via

source ~/.bashrc

litmus-zhang commented 9 months ago

Yeah I did,I tried it on Ubuntu 20.04 and 22,same issue after rebooting the whole PC.

On Wed, Dec 6, 2023, 4:34 PM sarvesh-git @.***> wrote:

Hello there, Did you added the path to your binaries to your system path variables?

export PATH=$PATH:/path/to/solana/bin change the "/path/to/solana/bin" to the actual path of your folder.

and then reload the shell to implement the changes made via

source ~/.bashrc

— Reply to this email directly, view it on GitHub https://github.com/solana-developers/solana-cookbook/issues/525#issuecomment-1843125462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUY2ZDNIRBD4JMHCYHAV73YICF7XAVCNFSM6AAAAAAYQZMEUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGEZDKNBWGI . You are receiving this because you were mentioned.Message ID: @.***>

Sarvesh-Ghildiyal commented 9 months ago

when you add the environment variable in the particular session then in that session of terminal are you able to use the cli?

litmus-zhang commented 9 months ago

Unfortunately, no. That's why I created the issue.

On Wed, 6 Dec 2023, 17:42 sarvesh-git, @.***> wrote:

when you add the environment variable in the particular session then in that session of terminal are you able to use the cli?

— Reply to this email directly, view it on GitHub https://github.com/solana-developers/solana-cookbook/issues/525#issuecomment-1843267244, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUY2ZDMRAXWKD7N2VD2K7TYICN7FAVCNFSM6AAAAAAYQZMEUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGI3DOMRUGQ . You are receiving this because you were mentioned.Message ID: @.***>

Sarvesh-Ghildiyal commented 9 months ago

i dont get it then, like you are saying, if you added the path to environment variable then atleast it should atleast work on the same terminal!

can you please provide some more details, error logs or so?

litmus-zhang commented 9 months ago

After setting the environment variable in the terminal window, It works on that window, but when I open another window, It says "Solana command not found"

On Wed, 6 Dec 2023, 17:55 sarvesh-git, @.***> wrote:

i dont get it then, like you are saying, if you added the path to environment variable then atleast it should atleast work on the same terminal!

can you please provide some more details, error logs or so?

— Reply to this email directly, view it on GitHub https://github.com/solana-developers/solana-cookbook/issues/525#issuecomment-1843287363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUY2ZDJBXORDRUHMUQMIGTYICPOJAVCNFSM6AAAAAAYQZMEUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBTGI4DOMZWGM . You are receiving this because you were mentioned.Message ID: @.***>

Sarvesh-Ghildiyal commented 9 months ago

Oh great! We on right track then glad 😌 it happened.

Soooo now what u gotta do is simple, just save the env variable manually open your bashrc in nano and paste the env path at the bottom of the file and save it.

nano ~/.bashrc

Then, at the bottom of file paste

export PATH=/your/directory/path:$PATH

With the actual path, save it and close it.

Johnsonojo commented 8 months ago

Oh great! We on right track then glad 😌 it happened.

Soooo now what u gotta do is simple, just save the env variable manually open your bashrc in nano and paste the env path at the bottom of the file and save it.

nano ~/.bashrc

Then, at the bottom of file paste

export PATH=/your/directory/path:$PATH

With the actual path, save it and close it.

Hi @Sarvesh-Ghildiyal I'm also having the same issue. I've tried your suggestions but it still doesn't work

willian-uiu commented 3 weeks ago

when you use the command export PATH="/home/userName/.local/share/solana/install/active_release/bin:$PATH" The SOLANA CLI turn open temporaly. You have to add this command on your .bashrc for work what you want

after do this, work on normally

link of reference: https://phoenixnap.com/kb/linux-add-to-path