The developer tool ninja-build can be installed from the official Ubuntu repositories. If you have installed the ninja-build package, you can see it's in version 1.3.4:
/usr/bin/ninja --version
1.3.4
But sometimes developers require (or want) a newer version. With ninja-build that's very easy to do because pre-compiled binaries are ready to download and use.
In this case I installed the current version of ninja-build 1.8.2 on an Ubuntu 14.04 Trusty machine.
Download the current release:
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
This file contains the ninja binary. I unzipped it into /usr/local/bin:
sudo unzip ninja-linux.zip -d /usr/local/bin/
Tell Ubuntu to use this new path for the "ninja" command:
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
update-alternatives: using /usr/local/bin/ninja to provide /usr/bin/ninja (ninja) in auto mode
Test version output:
/usr/bin/ninja --version
1.8.2
No need to compile from source in this case. Quick and efficient.
ck from Switzerland wrote on Aug 29th, 2020:
Kitty, this means that your local account needs sudo permissions, correct. At least when you want to use system wide alternatives. For your local environment you don't need it. You could also create an alias in your local shell environment, e.g. ninja="/home/kitty/bin/ninja" or something like that.
ck from Switzerland wrote on Aug 29th, 2020:
Hello Kitty. The sudo commands are already mentioned in the article. So you can basically do copy+paste.
Kitty from wrote on Aug 29th, 2020:
Hi,I followed the instructions without sudo permission. The first 2 lines of command run succcessfully, but the last command failed, the error is "update-alternatives: error: error creating symbolic link '/etc/alternatives/ninja.dpkg-tmp': Permission denied. "
Could you pls tell me how to fix it? Do I have to run these command with sudo perimission? Btw,I'm connectiong remote server,and I have my own environment which is not in usr/local/ file.
Thank you!
Frustrated Ubuntu User from wrote on Jan 9th, 2018:
Thanks, this has saved my ass
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office OpenSearch PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder