Categories
Software Development Web Development

How to install and configure Golang development environment on Ubuntu Linux

I am still working on this article as all information I’ve found about how to set PATH system wide in Ubuntu is totally wrong. I’ve yet to find a way to set Go in the PATH system wide on Ubuntu. The info in Golang Docs is even wrong for Ubuntu. This article will be updated when I discover the secret of Ubuntu PATH.

I wanted to know why Go documentation suggested saving PATH as it did, I get tired of not knowing why things are suggested. In this article I dig a little into setting PATH on Ubuntu and Linux in general.

First off go to the Golang website and download the latest version of Go. It doesn’t matter if it is in your Downloads folder, the following command unpacks it to the proper location.

Follow the instructions to unpack it for example

tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz

but with your version number you downloaded.

Now here is where I explain some things. The next step where it talks about setting the PATH environmental variable let me explain some things.

Where it says the following in the docs:

Add /usr/local/go/bin to the PATH environment variable.
You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):

These are the locations Linux usually will get environmental variables from.  Here is a link to explain /etc/profile I wanted to know what it did. Here is another link with more details. As you can see /etc/profile is one of he locations where linux gets things such as Environmental variables for the entire system.

The other $HOME/.profile refers to the logged in users home directroy .profile file. This is another location Linux looks for user environmental information. This article explains more about users profile files.

You can set the PATH there with this as they show :

export PATH=$PATH:/usr/local/go/bin

You put that in one of those files and what Linux does is it is adding that value to the current value for PATH you can also add it to the PATH variable for your entire system (not on ubuntu), located at /etc/environment  environment is a file. Open it with vim and you will see a really long string PATH=”longlines”

You can add to it by putting this at the end

:/usr/local/go/bin

So you will end up with something like
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin"

The way above using /etc/environment apparently isn’t system wide  on Ubuntu because of the way it disables the root account and uses something else a file called /etc/sudoers to store the PATH variable for the root user. Do not edit that directly you can destroy your login and system. User a tool called visudo.

The other ways work fine. If you add the path only to your regular user account in .profile then go won’t be available to root if you somehow need it.

/etc/profile (for a system-wide installation) is a little better because all users will have access. Otherwise each user you create you will have to add the PATH info to their .profile file, it gets to be a pain.

WARNING :
Doing it this way makes golang only available to the logged in regular user, at least on Ubuntu. /etc/environment is supposed to set PATH system wide but it doesn’t   on ubuntu.

I just wanted to dig and see why the docs suggested what it did. I get tired of everything in tech just telling people to do things without any explanation or links to info.

Next up setting configuration values, especially GOPATH – not so necessary from what I’ve been told. But the link explains the GOPATH and how to set it. I would do this because you will see many examples refer to GOPATH and you need to know what it is.

Categories
Resources Software Development

Linux commands resources and links

Difference between Ubuntu apt-get autoclean, clean, autoremove commands – it is important to know the difference.

Cleaning up with apt-get – how to clean up with apt clean command

How To Upgrade Ubuntu Using Command Line?

Linux << heredoc syntax info – great link has lots of good linux information

Here is an excellent link to a shell command cheatsheet. This lists the most commonly used shell programs.

An A-Z Index of the Linux command line: bash + utilities. – about the same as the list of shell commands above.20 Shell Scripting Questions for Practice

Writing text to files from shell or shell scripts

Awesome linux software – a list/article about awesome useful linux programs
Understanding Shell Initialization Files and User Profiles in Linux

20 Shell Scripting Questions for Practiceuses opensshLinux visudo command

Linux /etc/profile file information

Understanding a little more about /etc/profile and /etc/bashrc20 Shell Scripting Questions for Practice

Why and How to Edit Your Sudoers File in Linux

LINUX DIRECTORY STRUCTURE:/ETC EXPLAINED

Tutorialspoint Linux tutorials and really good information.20 Shell Scripting Questions for Practice

How to Use Sudo and the Sudoers File – very good article

Ubuntu Environmental variables – Ubuntu Documentation link

How to prompt for input from user in a linux shell script – article 20 Shell Scripting Questions for Practicecovers two ways to prompt users for input in shell scripts.

How to prompt and read user input in a Bash shell script – A good example of a script that prompts users for input and uses it.

Bash read builtin command – this command is built into bash meaning available without installing etc.

Linux while loop explained with examples of alternate syntaxes

How to create a self signed SSL certificate 

20 Shell Scripting Questions for Practice – article showing how to prompt users for input and how to answer prompts.


Categories
Resources Web Development

Links and resources about installing php and extensions

It took quite a bit of searching to find something that accurately describes how to currently install php and it’s extensions on Linux.

How to install php on ubuntu

Another good link on installing php 7.4 on ubuntu

Enable php modules/extensions on ubuntu