Cause
I had a chance to use a GPU environment on a shared server, but I couldn’t use sudo and had a hard time using basic git and vim, so I wrote it down. It’s hard to implement various source codes on the server without git and vim (vi is included), so I’ll try to get them into the local environment.
Environment
- wget, gcc are included.
- uname -a
Linux ubuntu 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Reference site
I used this one as a reference! It helped me a lot!
Basic flow
As mentioned in the reference site, you basically download, build, and install the shared libraries in your local environment, and then download, build, and install git, vim, etc. as needed.
The local directory to install the library should be ${HOME}/tools/src
according to the reference site. The library packages will be installed under tools
.
mkdir -p ~/tools/src
install libevent from source
Install libevent. This is a library for event notification systems.
When creating the makefile (. /configure), specify the location of the binary data to be created with --prefix
. If you don’t specify this, it will be created in /usr/local
, which is the default, and you will need root privileges. To avoid this, you need to specify ${HOME}/tools
to place the executable in the user’s local directory.
This --prefix
seems to be the most important one in this case.
cd ~/tools/src
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz -P ~/tools/src
tar -zxf libevent-2.1.8-stable.tar.gz
. /configure --prefix=${HOME}/tools
make
make install
install ncurses from source
Install ncurese, which is a library for creating terminal UI.
ncurese is a library to create a terminal UI, and you can specify a local directory in --prefix
.
cd ~/tools/src
wget -nc ftp://ftp.invisible-island.net/ncurses/ncurses-6.1.tar.gz
tar -zxf ncurses-6.1.tar.gz
. . /configure --prefix=${HOME}/tools
make
make install
install openssl from source
If you’re trying to install git, you’ll need openssl and curl, so you’ll need to install those first.
wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz
tar -xf openssl-1.0.2o.tar.gz
cd openssl-1.0.2o
. /config --prefix=${HOME}/tools --openssldir=${HOME}/tools shared zlib
make
make install
install curl from source
Build curl from source code.
wget https://curl.haxx.se/download/curl-7.xx.x.tar.gz
tar xvfz curl-7.xx.x.tar.gz
cd curl-7.65.3
- I had to include the –enable-libcurl-option option.
. /configure --prefix=${HOME}/tools --with-openssl=${HOME}/tools --enable-libcurl-option
make
make install
- The –with-openssl option specifies where to install openssl.
- You may want to remove the symbolic link that was created during make install.
install git from source
Build git from source code.
cd ~/tools/src/
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz
tar zvfx git-2.26.2.tar.gz
cd git-2.26.2
. /configure --prefix=${HOME}/tools LDFLAGS="-L${HOME}/tools/lib" CFLAGS="-I${HOME}/tools/include"
make
make install
install vim from source
vim is also built from source code. Choose vim.huge to make it easier to use various extensions.
git clone https://github.com/vim/vim.git
cd vim
. /configure --prefix=${HOME}/tools LDFLAGS="-L${HOME}/tools/lib" CFLAGS="-I${HOME}/tools/include" --with-features=huge --enable-pythoninterp --enable-python3interp
make
make install
Finally.
Nowadays, sudo apt install git
rarely gives me a permission denied message. Unless you’re messing with low-level languages, you don’t have many opportunities to build from source code, and this kind of operation can take up a lot of time. However, if I don’t have such opportunities, I might forget the basics of computer science or Linux.
It’s frustrating when I’m busy, but I’d like to deepen my understanding of Linux by taking it as a precious time to study. (It may be a proof that I am not a cloud native generation that I find significance in this kind of thing.)