How to install Emacs (Text editor) on ubuntu Linux

I have tried to install emacs from source that I downloaded from the internet.

For that first I have chosen a path like:

/home/anand/emac/emac-23.1 (where emac-23.1 is the extracted file)

Then I make it run like follows:

root@anand:/home/anand/softwares/emac/emacs-23.1# ./configure

But it displays:

checking build system type... i686-pc-linux-gnulibc1
checking host system type... i686-pc-linux-gnulibc1
checking for gcc... gcc
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables
See `config.log' for more details.

I also tried another way:

sudo apt-get install emacs

But it displays:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package emacs

All the above was done under an Admin Login, but I couldn't get it to work.


Solution 1:

$ sudo apt-get install build-essential
$ sudo apt-get build-dep emacs

Will help you download all the dependencies

My ubuntu has emacs22, if that will work for you

$ sudo apt-get install emacs <==note you missed the s on the end when you tried before

Solution 2:

sudo apt-get install emac

You have the package name wrong. Try:

sudo apt-get install emacs

Solution 3:

Are you using this in the shell or gnome?

try emacs snapshot for a better UI that looks like something which was not made in the 1990s

sudo apt-get install -y emacs-snapshot emacs-snapshot-el

and to launch it from without a windowing system

emacs -nw /path/to/your/file