How to update golang on codeanywhere.com with Ubuntu - go

How to update golang on codeanywhere.com with Ubuntu 14.04?
The default container uses the version from Ubuntu repos, instead of golang PPA.
As of writing it's 1.6 and the newest version is 1.9.

(can't comment yet) Just an additional information, the steps in Paweł Prażak's answer work when you run on a Blank Container. If you run them on a Go predefined stack it won't update.
I also recommend to change the GOPATH value to your workspace, running
export GOPATH=$HOME/go
Then run go env to check if the values are correctly updated.
Thanks for the answer by the way, Paweł!

You can easily install the latest golang release in the container by using this script:
git clone https://github.com/udhos/update-golang
cd update-golang
sudo ./update-golang.sh
Full details: https://github.com/udhos/update-golang

Create and new Blank Container with Ubuntu:
Connect to the container with SSH.
Follow the instructions on the official wiki.
First install the add-apt-repository support:
sudo apt-get update
sudo apt-get install -y software-properties-common
Now install the recent version of golang (refer to the wiki for up to date instructions):
sudo add-apt-repository ppa:gophers/archive
sudo apt-get update
sudo apt-get install golang-1.9-go
Make sure to put the binary on PATH, e.g.:
sudo ln -s /usr/lib/go-1.9/bin/go /usr/local/bin/go
Now the newer version should be available:
$ go version
go version go1.9.2 linux/amd64
Add $GOPATH pointing to the workspace and add $GOPATH/bin to $PATH in ~/.profile:
cat << EOF >> ~/.profile
export GOPATH="\$HOME/workspace"
export PATH="\$GOPATH/bin:\$PATH"
EOF
Apply the new ~/.profile:
. ~/.profile
Also make is missing, if you need it:
sudo apt-get install build-essential

Related

Problem with installing Go on Ubuntu 20.04 server

I am new to Ubuntu and am trying to install Go onto my server, however I get an error when trying to use Go.
Command 'go' not found, but can be installed with:
sudo apt install golang-go # version 2:1.13~1ubuntu2, or
sudo apt install gccgo-go # version 2:1.13~1ubuntu2
The commands I used to install Go are below.
$ wget https://dl.google.com/go/go1.15.10.linux-amd64.tar.gz
$ sudo tar -xvf go1.15.10.linux-amd64.tar.gz
$ sudo mv go /usr/local
Then I appended the following to the bash_aliases file.
$ vi ~/.bash_aliases
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
What am I doing wrong here?
I will give you some suggest.
check your path var
echo $PATH
Since you edit ~/.bash_aliases, I think you maybe not source this file.
please try source ~/.bash_aliases.
or try
export $PATH=$PATH:/usr/local/go/bin
beside ~/.bash_aliases may not be load by default. see if . ~/.bash_aliases is in your ~/.bashrc file.
Check if bin can run
/usr/local/go/bin/go version
if have error, maybe is the package you download is wrong. checksum the tar package(for example: md5sum xxxx.tar.gz).
check the default path of go
which go
if go bin not in /usr/local/go/bin/go, you should delete the go bin that shown by which go
Using APT, there is an official package you can install using Ubuntu
Open a terminal and run:
sudo apt update
sudo apt install golang-go
Depending on your version of Ubuntu, you may have to run:
sudo apt install golang
Hope this helps! Its my first answer!

How to downgrade libprotobuf.so

I'm trying to run a .pyc which shows this msg:
ImportError: libprotobuf.so.9: cannot open shared object file: No such file or directory
I have a newer version of libprotobuf.
Do you know how to solve this issue? I think the only way is to downgrade libprotobuf. But how can I do that and install the exact version it is asking me for?
Thanks in advance
My ubuntu 18.04 had a same problem and I solved it as follows.
Here are different version libprotobuf
(https://pkgs.org/download/libprotobuf)
$ sudo apt-get update
$ sudo apt-get install gdebi
$ wget http://archive.ubuntu.com/ubuntu/pool/main/p/protobuf/libprotobuf9v5_2.6.1-1.3_amd64.deb
$ sudo gdebi ./libprotobuf9v5_2.6.1-1.3_amd64.deb
You can use gdebi to install this deb package solving dependencies.

can not install mvn 3.3.3 on ubuntu 14.04

I am using Ubuntu 14.04. I need to run mvn 3.3.3. Currently, the installed mvn version 3.0.5. When I enter
sudo apt-get install maven
it says
maven is already the newest version
is there a way to force install mvn 3.3.3?
Add a ppa containing maven 3.3.3, for example this one by executing these instructions on the command-line:
sudo apt-get purge maven maven2 maven3
sudo add-apt-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3
If you are not comfortable with a PPA (personal package archive) where you have no assurance of the provenance this is an alternative.
From a security perspective if you don't know where it came from don't install it.
In my linked article I retrieve the latest file from apache which is a known and trusted source. You can get the latest version
\#identify the latest version of maven
latest=$(curl http://www-us.apache.org/dist/maven/maven-3/ | tac | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,3\}[0-9]\).*/\1/p' | head -1)
\#download it
wget http://www-us.apache.org/dist/maven/maven-3/$latest/binaries/apache-maven-$latest-bin.tar.gz
then install it from
\#Unpack it
sudo tar -zxf apache-maven-$latest-bin.tar.gz -C /usr/local/
\#create a sym link to it
sudo ln -s /usr/local/apache-maven-$latest/bin/mvn /usr/bin/mvn
as outlined in the link above.
I just installed maven 3.2.5.
To do that I downloaded the version I wanted as noted.
Unzipped using: tar -xvf apache-maven-3.2.5-bin.tar.gz
to: /opt/ and let p7zip do its thing.
Then in the terminal I did the following:
Check environment variable value:
echo $JAVA_HOME
Adding to PATH:
export PATH=/opt/apache-maven-3.2.5/bin:$PATH
typed: mvn -v
reviewed the output
For me the above worked fine.

How to install Ruby on Red hat

I'm trying to install ruby on Red Hat, via an ssh-connection, but it won't work.
I can't use yum install ruby, because I don't have the needed repositories.
I have three options for you:
1) You can install it from sources.
First of all you'll need to install some build tools and libraries.
On Centos/RedHat the easiest way to do it is using yum groupinstall 'Development Tools'.
If this doesn't work you'll need to run at least: yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel the bare minimum to build. Eventually is you have no internet access and just ssh you can SCP the single packages from your machine.
Once installed build tools , if you have internet access on those machines, I suggest also to install RVM to make less painful upgrade and not have to mess around with path definition for the new libraries and binaries.
To install it is quite simple curl -L get.rvm.io | bash -s stable will do the trick and after a rvm install <version> will permit you to install (for this user) any ruby version you want and create gemset without touch the system.
Be aware that installing new gems that need to be build will require to install other devel libraries if they have compiled extensions.
Have also a look to http://rvm.io/rubies/installing for more references about rvm use
Otherwise you can use #hizbul25 tutorial to install std ruby from source.
2) You can use omnibus, https://github.com/opscode/omnibus-ruby, is the package useb by Opscode, Mcollective and other tools to create a selfcontaines VirtualEnvironment for specific application.
You can select the gem and the ruby version you need and it will create a tgz with all you need to run ruby scripts.
This tgz can be uncompressed where you want (ex: /opt/omnibusruby/) and you'll need just to point the shebangs of your scripts to #!/opt/omnybusruby/embedded/ruby-2/bin/ruby or create a an alias /usr/bin/ruby -> /opt/omnybusruby/embedded/ruby-2/bin/ruby.
If you have no internet access at all from the server is probably the best way to prepare the package on your laptop/system and deploy it on the remote.
I recently installed Rails for the CodeReady Containers implementation of OpenShift in RHEL8/Cento8, using an OpenShift quickstart template. And in fact using rbenv now seems the cleanest way to install ruby:
sudo yum groupinstall "Development Tools"
sudo yum install readline-devel openssl-devel
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install -l
rbenv install 2.7.5
rbenv global 2.7.5
ruby -v

Error while installing ruby using rvm

Am getting the below error while trying to install ruby using rvm:
$rvm install 1.9.3
Searching for binary rubies, this might take some time.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..................................................................................................
Error running 'requirements_debian_update_system ruby-1.9.3-p448',
please read /home/troy/.rvm/log/1379872584_ruby-1.9.3-p448/update_system.log
Requirements installation failed with status: 100.
Can you help me on this!
Remove broken or 404 repos from your /etc/apt/sources.list.
rvm will fail if you don't remove or comment them out.
To work out which aren't working, run apt-get update and see which ones are marked as failing.
Once you are using rvm, installing Ruby is easy.
rvm install ruby
rvm use ruby --default
I had the same problem.
It isn't unusual to not have a binary package for you distribution, and rvm should try to install from source.
First, check that it didn't actually install it:
rvm list
Otherwise, I suspect you may be missing some depedencies, which you can find with:
rvm requirements
You'll need to install those and the run the install again.
make sure you can update your system:
sudo apt-get update
and then start rvm installation again.
Update 1:
also it looks like you are using old version of rvm, make sure to update rvm before continuing:
rvm get stable
been having a similar problem and discovered a typo in grizzly.list file
http://ubuntu-cloud.archive.cononical.com precise-updates/grizzly
should have been
http://ubuntu-cloud.archive.canonical.com precise-updates/grizzly
i.e. first a in canonical
is this mistake part of the ubuntu 12.04 distribution?
Make sure when you run sudo apt-get update, all your PPAs are updating correctly. If not, remove them or edit them so they do so (you might need to change the distribution, for example, from raring to lucid. You can do this through terminal or Software Center. This and this should help)
When you are initially installing rvm, read the notes. For suppose you get notes like,
create a * WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/home/name/.bash_profile':source ~/.profile
Then-> $ sudo gedit /home/name/.bash_profile
Add line `~/.profile` to the file. Save and close it.
now run $ rvm requirements
You should get a success message.
RVM will not install ruby if apt-get is failing. I had the same issue and noticed when running apt-get update, it was failing on "google-chrome.list". I fixed it following these directions and was then able to successfully run apt-get update, which then allowed me to run rvm install ruby.
Edit google-chrome.list (assuming you’re on the Stable Channel):
sudo gedit /etc/apt/sources.list.d/google-chrome.list
In the text file that opens edit the file so that the line reads:
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
Try to update again:
sudo apt-get update
Try to run RVM again:
rvm install ruby
this problem caused in apt-get update so you have to disable the PPA :
System Settings>Software & Updates>Other Software
then reinstall.
this image show disable PPA
I was facing the same problem and just did that:
sudo rm /etc/apt/sources.list.d/webupd8team-ubuntu-sublime-text-3-bionic.list
Now it works!
I faced the same problem while executing the command
curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails
It appeared to be that I was using the command as not a previleged user. So, using
sudo curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails
solved the problem
Below solution is to solve the rvm requirment error returns 100
If any deb command is commented in /etc/apt/sources.list than try to uncomment that command from /etc/apt/sources.list
Command is:
$sudo vi /etc/apt/sources.list
If problem is not solved than replace sources.list file with other Ubuntu's sources.list
Command is:
$mv /etc/apt/sources.list
Please make a backup before doing that
Command is:
$cp /etc/apt/sources.list sources_backup.list
Problem should solve by this time, if not than reinstall the Ubuntu.
Note: If sources.list file is corrupted than it will gives problem to install other packages.
I had a permission problem, solved with:
sudo chmod 777 log
I had the above error on installing ruby-2.3.0 in Ubuntu 16.04.
Go to the file:
/etc/apt/sources.list.d/mc3man-ubuntu-trusty-media-xenial.list
and remove the below:
deb-src http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial main
deb http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial main
then run sudo apt-get update and after rvm install ruby-2.3.0 it's working.
you can temporarily disable updates by this
sudo apt-get update | grep "Failed"
Ruby RVM apt-get update error

Resources