How to manually install and uninstall Rust? - rust

I'd like to try on a "hello world" program on Rust. I didn't choose rustup for auto-installation but downloaded the standalone installer. I thought I could follow the classic way to manually install it on Linux platform bundled with GCC and Clang below,
$ tar xf rust-xxx.tar.gz; mv rust-xxx $RUST_HOME
$ cd /usr/local/bin; sudo ln -s $RUST_HOME/bin/rustc
$ rustc hello.rs; ./hello
However I found install.sh inside, so I have to run it for the installation, don't I? How to completely uninstall it afterwards?

I just downloaded the archive you linked and had a look inside the installation script.
During installation it will create an uninstall.sh script and actually print out for you the location:
install_uninstaller() {
local _src_dir="$1"
local _src_basename="$2"
local _abs_libdir="$3"
local _uninstaller="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/uninstall.sh"
msg "creating uninstall script at $_uninstaller"
run cp "$_src_dir/$_src_basename" "$_uninstaller"
critical_need_ok "unable to install uninstaller"
}
#...
# Install the uninstaller
install_uninstaller "$src_dir" "$src_basename" "$abs_libdir"

Related

Pybind11 linux building tests failure - 'Could not find package configuration file pybind11Config.cmake and pybind11-config.cmake'

I'm trying to build pybind11 tests on a linux box. I downloaded the source and do the following -
cd pybind11-master
cd tests
mkdir build
cd build
cmake ..
I get the errors -
` Could not find a package configuration file provided by "pybind11" with any of
the following names:
pybind11Config.cmake
pybind11-config.cmake
Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set "pybind11_DIR" to a directory containing one of the above files. If "pybind11" provides a separate development package or SGK, be sure it has been installed
`
I followed this link - http://pybind11.readthedocs.io/en/master/basics.html and did as per the instruction in section 'Compiling Test Cases for linux/mac'
I am not sure how to proceed. Any pointers are helpful.
I already hit the same problem after installing pybind11 by pip install pybind11.
I'll post here my solution in case someone ends up here.
I installed following this link, everything went ok, and the file needed was there.
Basically:
$ git clone https://github.com/pybind/pybind11.git
$ cd pybind11
$ mkdir build
$ cd build
$ cmake ..
$ make -j`nproc`
$ make check
$ make -j`nproc` install

./configure error while installing conky

I've downloaded conky from GitHub and when I try to use the ./configure command, I get this following error :
bash: ./configure: No such file or directory
I opened my terminal in the Src folder and tried this command. What am I missing?
This is the screenshot of the terminal and the downloaded conky folder
I see CMakeLists.txt and doubled checked, per the documentation use cmake
1.10 and later versions
Conky 2 will use cmake instead of autotools which means you won't need autoconf and automake anymore but you'll need cmake.
autoconf and automake (and autogen) are what generally drive "configure".
You will need the tolua library (Ref.), which can be installed for Linux with apt-get install libtolua-dev libtolua++5.1-dev. You also need the following development packages if you keep the default cmake configuration: apt-get install libx11-dev libxft-dev libxdamage-dev libncurses5-dev libxinerama-dev.
Then, building conky will work like this:
$ mkdir build
$ cd build
$ ccmake ..
# this will launch a curses-based UI where you can configure
# everything, when you are ready you can build as usual:
$ make # This will compile conky in the `src` subdirectory
$ make install

Installing a tar.gz on Linux

I have downloaded Node.js from this link, which points to this link when clicking the button:
https://nodejs.org/dist/v4.1.2/node-v4.1.2-linux-x64.tar.gz
As advice from the Ubuntu community on installing the tar.gz, the following steps are followed.
$ ./configure
$ make
$ [sudo] make install
The problem is the current file I have downloaded does not contain ./configure.
So how do I install this? Should I extract this to the usr/ folder?
My OS is Debian 8 (Jessie).
Should I include the Java package from Oracle? Is it safe to extract these files to the /usr folder?
You can download this file from the browser or from the console. The latter is shown below (note: the specific Node.js version might be different for you):
Example :
wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz
sudo tar -C /usr/local --strip-components 1 -xzf node-v8.1.1-linux-x64.tar.gz
#tar options:
-x, --extract, --get
extract files from an archive
-f, --file ARCHIVE
use archive file or device ARCHIVE
-z, --gzip, --gunzip --ungzip`
You may find list of node version on http://nodejs.org/dist/
You should now have both Node.js and npm installed in “/usr/local/bin”. You can check this typing:
ls -l /usr/local/bin/node ls -l /usr/local/bin/npm
*An alternative way to install Node.js via the package manager:
Installing Node.js via package manager
Download the .tar.xz file form https://nodejs.org/en/ and then press Ctrl + Alt + T.
Then go to the destination that you downloaded your file to. For me it's my downloads folder. Then hit this command and Node.js will get installed on your system:
sudo tar -xf node-v16.0.0-linux-x64.tar.xz --directory=/usr/local --strip-components=1
This was the answer I had posted over two years ago, and here is what I recommand you right now, decompress the tarball, and keep it anywhere where your system knows ( tell it via updating $PATH ), its just a binary file, its not necessary to keep it in some specific location, you can keep it in your home directory and andd your bin folder to your bashrc or whatever shell you are using, its .rc file, and it will work just fine, at the end of the day, its just a pre-compiled binary file (inside node) nothing much.
Somebody in the comment section was saying npm, needs to be installed sepretly, this was in the early days of node back in 2012, when npm used to not ship with node, if you look inside bin folder npm binary is also there, so you dont need to install npm sepretly.
In case of installing from source code, you must download source code from https://nodejs.org/dist/v4.1.2/node-v4.1.2.tar.gz.
The file ending with .tar.gz is the compressed file like zip file, and you should extract the file before you can do another operation.
You can extract this file anywhere you need. In the terminal, change the location to your .tar.gz file:
$ cd /path/to/tar.gz/file
Then extract it using tar:
$ tar xvzf node-v4.1.2.tar.gz
Then change the location to the extracted directory
$ cd node-v4.1.2
After this, you can run .configure and 'make' it:
$ ./configure
$ make
$ [sudo] make install
Using the make utility is only necessary if you're compiling software. However, the tarballs provided by nodejs.org contain compiled binaries, not source code. Really you don't need to install it to use.
You can simply cd into the bin directory and run it via ./node. Though I'll say it's pretty useful to have it in your PATH. Where you put this directory doesn't really matter.
If you're installing it locally on your own machine, you can just untar it, tar xvfz node*tar.gz, to your home directory, add this to the file ~/.bashrc, and append the directory path your your PATH environment variable like so PATH=$PATH:/home/USERNAME/DIRECTORY/bin. Just change the path to the exact path to the bin folder in the directory you extracted.
You can also add these files to a directory that's already in your path, such as /usr/share or /usr/local by simple copying the files from the archive into these folders, as they share the same structure.
Run the following commands where your ta.xz file (no need for extraction) file is located in the terminal. NB: I used Kali Linux
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-v14.4.0-linux-x64.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-node-v14.4.0-linux-x64/bin:$PATH
You can now check npm -v, node -v, and npx -v.
STEP 1:
Download your version of Node.js from the Node.js website or use the below command with your version:
wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz
You will get a Node.js file tar file after the above step.
STEP 2:
Just use the below command for installation
sudo tar -C /usr/local --strip-components 1 -xvf node-v8.1.1-linux-x64.tar.gz
I am mentioning version-specific installation of NVM and Node.js.
If you don't have brew installed, run this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If you don't have wget installed, run this:
brew install wget
To install Node.js of a specific version, run these commands: Here, I'm installing NVM - v0.33.1 and Node.js of v0.12.6.
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
source ~/.bashrc
nvm install v0.12.6
command -v nvm //verify install
You can do some this:
# Using Ubuntu or Debian
curl -sL https://deb.nodesource.com/setup_[version].x | sudo -E bash -
sudo apt-get install -y nodejs
Where [version] must be replaced for your version of Node.js that you required install
For example, I required to install Node.js v.12
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Download a suitable installation from
https://nodejs.org/en/download/
Incase of CentOS
Go to the downloaded file location
Execute the following
sudo tar -C /usr/local --strip-components 1 -xf "name of the tar.xz downloaded"
Check the installed version is correct
node --version
The given solution is correct, but it works for the source file and not the Linux distribution link used in the question above.
$ ./configure
$ make
$ [sudo] make install
The correct link is: https://nodejs.org/dist/v8.11.2/node-v8.11.2.tar.gz and we can use the above steps after downloading and extracting this file.
Download the latest version of Node.js from the official site, https://nodejs.org/en/
Steps to install:
Extract to any of the directories where you wish to install Node.js using a command or archive manager window
Open the terminal
Run '$sudo su'
Being superuser and open the profile file using 'nano ~/.profile'
At the end of the file, add:
# Node.js
export PATH=/path-to-bin.executable:$PATH
The path to bin application located within the bin folder of Node.js extracted folder is to be pasted in the above line
Save using Ctrl + O then come out by Ctrl + X
Refresh profile by the command '.~/.profile'
Come out of superuser by the 'exit' command
Again for normal users, use 'sudo'
'sudo nano ~/.profile'
Add the line at the end:
# Node.js
export PATH=/path-to-bin.executable:$PATH
Same as in step 5
Save and exit
Here the refresh command as above won't work, so restart the system to finish installation correctly
To get the version, issue 'node -v'

How do I install Cppcheck using the tar file on Linux?

I'm trying to install Cppcheck via telnet on a Linux box. I have the cppcheck-1.67.tar file and I untar it. I don't see anything that will install it for me. Am I approaching this the correct way?
Actual on a date publication of this answer.
Download file from there https://sourceforge.net/projects/cppcheck/
Go to the folder with for downloads
cd ~/Downloads/
Unpack archive
tar -xvf cppcheck-1.76.1.tar.bz2
Go to unpacked folder
cd cppcheck-1.76.1/
Install package as root
sudo make install
Check up result
$ which cppcheck
/usr/bin/cppcheck
Testing it
$ touch simple.c
$ echo "int main(){ int a; a + 1; return 0}" > simple.c
$ cppcheck simple.c
Checking simple.c ...
[simple.c:1]: (error) Uninitialized variable: a
This package also exists in a standard repository.
$ aptitude search cppcheck
p cppcheck - tool for static C/C++ code analysis
Testing environment
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
The instructions are in the readme.txt file. The short answer is make install.
Remember never to install things from a tar file when you can use your distribution's package manager.
The readme.txt file makes no mention of "make install".
It looks like the supplied Makefile is borked:
It passes "CFG=" param to compile, without DESTDIR
But "make install" prepends DESTDIR to CFGDIR
In my case, I edited Makefile to remove DESTDIR from make install, and cppcheck is happy with that.
For me the magic lines turned out to be the following in Docker on Ubuntu 18.04 (Bionic Beaver):
RUN cd /tmp \
&& git clone https://github.com/danmar/cppcheck.git \
&& cd cppcheck \
&& git checkout 1.72 \
&& make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes install \
&& cd /tmp \
&& rm -rf /tmp/cppcheck \
&& ldconfig
I assume the following will work for any version. I am not sure where it makes sense to install the configuration to. This works for me:
make SRCDIR=build CFGDIR=/usr/bin/cfg HAVE_RULES=yes install
If you want a later version than in the other answers, and you want to install it, then you can use the bash script below which is up to date and builds on the other answers. It should also clean itself up afterwards. It works for version 2.7 on debian/ubuntu but you can change the git checkout tag and try your luck on newer versions.
installcppcheck.sh
#!/usr/bin/env bash
set -e
cd /tmp
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
git checkout 2.7
make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install
cd /tmp
rm -rf /tmp/cppcheck
ldconfig
cppcheck --version
If you don't have sudo privileges you can follow #Seti Volkylany's answer, replacing step 5 with
OUT_PATH=/home/user/bin # target location of binary
make SRCDIR=build CFGDIR=~/Downloads/cppcheck-1.76.1/cfg PREFIX=$OUT_PATH
make install CFGDIR=$OUT_PATH/cppcheck-1.76.1/cfg PREFIX=$OUT_PATH

Installing Git with non-root user account

I've already set up a Git repository on GitHub and committed a few changes from my Windows machine.
But tomorrow I'll have to work in this repository from a machine running Ubuntu with limited privilege (i.e. no sudo).
Is there a portable version of Git for Linux? Or some source that allows me to compile and install Git only for the current user?
You can download the git source and do ./configure --prefix=/home/user/myroot && make && make install to install git to your home directory provided you have the build tools. If you don't have the build-essential package installed (dpkg --list|grep build-essential), you will need to install those to your home directory as well.
I don't like link-only answers, but this link I followed step-by-step on a Fedora machine and it worked without modification. Very, very easy. The binaries end up in your ~/bin directory. You download a tarball, extract the sources, run make and run make install and that is it.
As the author states, the 2 prerequisites are gcc and ssh and if you meet these git should work for you as a non-root user.
To install git and dependencies from source the following maybe useful.
Replace with the location you are installing your non-root apps and consider checking for latest versions of source code.
wget https://curl.haxx.se/download/curl-7.47.1.tar.gz
tar -xf curl-7.47.1.tar.gz
mkdir <local_curl_dir>
cd curl-7.47.1
./configure --prefix=<local_curl_dir>
make
make install
wget http://downloads.sourceforge.net/expat/expat-2.1.0.tar.gz
tar -xf expat-2.1.0.tar.gz
mkdir <local_expat_dir>
cd expat-2.1.0
./configure --prefix=<local_expat_dir>
make
make install
wget https://github.com/git/git/archive/v2.6.4.tar.gz
tar -xf v2.6.4
mkdir <local_git_dir>
cd git-2.6.4
make configure
./configure --prefix=<local_git_dir>/git --with-curl=<local_curl_dir>/curl --with-expat=<local_expat_dir>/expat
make
make install
This is what I ended up doing, the main trick being the make flags:
wget -O git.tar.gz https://github.com/git/git/archive/v2.17.0.tar.gz
tar zxf git.tar.gz
mv git-2.17.0 git
cd git
make configure
./configure --prefix=`pwd` --with-curl --with-expat
# ./configure --prefix=`pwd`
# Make flags from https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA#mail.gmail.com/
make NO_GETTEXT=Nope NO_TCLTK=Nope
make install NO_GETTEXT=Nope NO_TCLTK=Nope
Credits:
79E09796's answer above was a good tip, but didn't work for my case on Cloudways and did not require compiling curl and expat.
A random email record I found on the internet: https://public-inbox.org/git/CAP8UFD2gKTourXUdB_9_FZ3AEECTDc1Fx1NFKzeaTZDWHC3jxA#mail.gmail.com/
A related answer is https://askubuntu.com/a/350.
I could get it work with the third method proposed:
apt-get source git
cd git_vXXX
./configure --prefix=$HOME
make
make install
I don't know why, but when I had tried to install from the source download from github instead, I had a lot of problems with missing dependencies
Overkill workaround
Install Anaconda as a user and install git with conda.
Advantages
Anaconda can be installed as user, and a conda environment can be created which can help you to install other packages. This way you don't need to compile git from source, nor you need to install libcurl and perl, so you won't get the error
git: 'remote-https' is not a git command. See 'git --help'
after successfully compiling git.
Steps to install Anaconda, then git
read the Anaconda installation manual which points to the download page's shell script file.
Download the script file:
copy to your local machine and then copy with scp (e.g. winscp) to the Linux machine or
use a terminal on the Linux machine and issue wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh.
add executable rights to yourself on the file by issuing chmod +x Anaconda3-2020.11-Linux-x86_64.sh
follow the installation instructions where you can also specify into which folder you want to install anaconda
after installation, chose one of the possibilities below to successfully invoke git later:
you either activate a conda environment, which is useful e.g. if you need to create different conda environments (it is common if you work with python). To activate an environment, you need to ask the installer (at the end of the installation) to add the conda initialization code into your ~/.bashrc file [see below]. Using this method, your path won't be polluted, and you will see if conda-related binaries are also in your current path. Or you can
add the installed bin's folder to your path, e.g. if you installed anaconda into /home/myusername/anaconda3, it will be in /home/myusername/anaconda3/bin. Your new executable file conda will be also there which will help you to install packages like git, python or pandoc, or
cd into the binary folder of anaconda, e.g. cd /home/myusername/anaconda3/bin, and execute the commands below.
don't forget to take into effect the new settings by, e.g., closing and opening the terminal again if you selected method 1. or 2. in point 5. If you selected 1, you will see something like (base) myusername#servername indicating you are using the base conda environment.
Now you can install git using conda by issuing conda install -c anaconda git.
Your .bashrc will contain likes like this if you told the Anaconda installer to initialize conda for you:
# content of your .bashrc in your home dir
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/myusername/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/myusername/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/myusername/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/myusername/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
for the latest version(which i mean git-2.25.0-rc1 or upper), you need to
wget https://github.com/git/git/releases/tag/v2.25.0-rc1 -O git.zip
unzip git.zip
cd git-2.25.0-rc1
export PATH=`pwd`:$PATH
and of course, you can add the last line into your .bashrc or .zshrc or something else for more convenience.

Resources