User Tools

Site Tools


linux:compiling-software-gnu-nano

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:compiling-software-gnu-nano [2019/01/21 11:09] (current)
seanburns created
Line 1: Line 1:
 +<​markdown>​
 +# Compiling GNU Nano
 +## Date: Tue Sep 18 09:43:02 EDT 2018
  
 +Brief tutorial on compiling software.
 +
 +## Prep
 +
 +First, start your Fedora VM machine in VirtualBox, update it, and then power it 
 +off. To update, use *dnf*:
 +
 +``$ sudo dnf check-update ; sudo dnf update``
 +
 +And then poweroff:
 +
 +``$ sudo poweroff``
 +
 +Once it's powered off, use VirtualBox to clone it. After the clone is created, ​
 +start the clone. Once you have a command line, install the C development tools:
 +
 +``$ sudo dnf groupinstall 'C Development Tools and Libraries'​``
 +
 +## Download the Source ​
 +
 +We will need to download the source code to both [nano][1] and [ncurses][2]. ​
 +We'll do that with *wget*.
 +
 +[1]:​https://​www.nano-editor.org/​download.php
 +[2]:​https://​www.gnu.org/​software/​ncurses/​
 +
 +First, create a **src** directory in your home directory and change to it:
 +
 +``$ cd ; mkdir src ; cd src``
 +
 +Download the most recent, stable versions of *nano* and *ncurses*:
 +
 +```
 +$ wget https://​www.nano-editor.org/​dist/​v3/​nano-3.0.tar.xz
 +$ wget https://​ftp.gnu.org/​gnu/​ncurses/​ncurses-6.1.tar.gz
 +```
 +
 +**STOP HERE. We'll discuss and do the rest in class**
 +
 +## Extract the Source
 +
 +Use *tar* to extract the tarballs:
 +
 +```
 +$ tar xf nano-3.0.tar.xz
 +$ tar xf ncurses-6.1.tar.gz
 +```
 +
 +## Read the READMEs
 +
 +Change to each of the new directories and read the README files.
 +
 +## Compiling from Source
 +### Configure, Make, Make Install
 +
 +First change to the *ncurses* directory:
 +
 +``$ cd ncurses-6.1``
 +
 +And then configure, make, and make install:
 +
 +```
 +$ ./configure
 +$ make
 +$ sudo make install
 +```
 +
 +If successful, then change to the *nano* directory, and repeat the above:
 +
 +```
 +$ cd ../nano-3.0
 +$ ./configure
 +$ make
 +$ sudo make install
 +```
 +
 +Since *nano* was already installed on your system, you now have two versions. ​
 +The compiled version is installed in **/​usr/​local/​bin/​**. Compare:
 +
 +```
 +$ which nano    # to see which is the default
 +$ whereis nano  # to see where nano exists on the system
 +$ # compare binaries
 +$ /​usr/​bin/​nano --version
 +$ /​usr/​local/​bin/​nano --version
 +```
 +
 +Let's update our $PATH variable to remove the old version. Make sure
 +that you're in your home directory, and then:
 +
 +``$ nano .bash_profile``
 +
 +In the text editor, append the following text with the pathname ​
 +**/​usr/​local/​bin/​**:​
 +
 +This:
 +
 +PATH=$PATH:​$HOME/​.local/​bin:​$HOME/​bin
 +
 +Becomes this:
 +
 +PATH=$PATH:​$HOME/​.local/​bin:​$HOME/​bin:/​usr/​local/​bin/​
 +
 +Save and exit from nano and then source the file. Sourcing the file
 +makes bash aware that the $PATH variable has been changed:
 +
 +```
 +$ source .bash_profile
 +$ which nano
 +```
 +
 +Now, we can remove the older version of nano:
 +
 +```
 +$ dnf list installed nano
 +$ sudo dnf remove nano
 +```
 +
 +Note: ``./​configure --help`` to get a list of possible options.
 +</​markdown>​
linux/compiling-software-gnu-nano.txt ยท Last modified: 2019/01/21 11:09 by seanburns