How to update specific package such as nginx

New to Debian (Or Linux in general)? Ask your questions here!

How to update specific package such as nginx

Postby aliweb » 2017-08-05 09:53

Hi,

I am new to Linux environment. I am trying to install nginx on Debian 8 (minimal) by running following command but it shows error:

Command
Code: Select all
apt-get install nginx


Error
Code: Select all
Unable to locate package nginx


Upon searching I found out that I need to "update" by running following command:

Code: Select all
apt-get update


But what if I only want to install nginx and nothing else? As I understand this update command updates every package (or the available ones) and many of them I won't be needing I guess. So is there a way to install just specific software like nginx?

Thanks
aliweb
 
Posts: 22
Joined: 2017-08-04 05:54

Re: How to update specific package such as nginx

Postby arochester » 2017-08-05 10:25

In a nutshell, apt-get update doesn't actually install new versions of software. Instead, it updates the package lists for upgrades for packages that need upgrading, as well as new packages that have just come to the repositories.

https://askubuntu.com/questions/222348/ ... -update-do

Code: Select all
apt-get install --only-upgrade <packagename>
"Something to be aware of: Debian is a core or source distribution. This means there are many Debian-based distributions. THEY ARE NOT DEBIAN."
arochester
 
Posts: 993
Joined: 2010-12-07 19:55

Re: How to update specific package such as nginx

Postby aliweb » 2017-08-05 13:24

arochester wrote:
In a nutshell, apt-get update doesn't actually install new versions of software. Instead, it updates the package lists for upgrades for packages that need upgrading, as well as new packages that have just come to the repositories.

https://askubuntu.com/questions/222348/ ... -update-do

Code: Select all
apt-get install --only-upgrade <packagename>


Ok if I understood correctly:

    If some software is not currently installed for e.g. nginx then running this command will update package list and then we can install that software
    If some software is already installed for e.g. nginx and if there is upgrade available for that software then running this command will update package list and then we can upgrade that software
aliweb
 
Posts: 22
Joined: 2017-08-04 05:54

Re: How to update specific package such as nginx

Postby dasein » 2017-08-05 13:35

First, have a look at this "sticky" posting right here in Beginners Questions: viewtopic.php?f=30&t=47078

Then read a measly 1% of these existing answers, or a few thousand of these ~3,000,000 tutorials and HOWTOs on apt-get, before you decide that you simply must have the answer retyped yet again especially for you.
User avatar
dasein
 
Posts: 7770
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: How to update specific package such as nginx

Postby GarryRicketson » 2017-08-05 16:06

It is very obvious the OP is not making any effort to research their project, other then asking here, there are plenty of good tutorials available that go into step by step details.
But before even thinking about installing nginx, myssql, php, etc. it would be much better
to learn a little just about Debian, package installation, configuration ,etc.
If the OP simply must have the shiniest newest version of nginx, they will need to download it, and install, it will not be available in the Debian repositories, I don't care how
many times they run 'apt-update' or upgrade etc,...
Before deciding to use the shiniest ,newest version, the OP should read:
https://wiki.debian.org/DontBreakDebian

Then :
from:https://www.linode.com/docs/web-servers/nginx/install-nginx-web-server-on-debian-8
Install nginx
From Debian Repositories
The simplest way to install nginx on a server is to download it from Debian’s repositories.
Install nginx and start the daemon:
Code: Select all
 sudo apt-get install nginx

Installing nginx from the Debian repositories ensures that nginx has been tested and will optimally run on Debian. However, Debian repositories are often a few versions behind the latest nginx release.
Nginx can be tested by navigating to your FQDN in your browser. The default nginx page should be present.

The same tutorial, above, also goes into how to install it , from the nginx site, and install the shiniest newest version, BUT I strongly do not recommend that.
If the OP does not like the particular tutorial I linked to, there are many others, as pointed out by Dasein,..
Just do a simple search, :
How to instal nginx on Debian 8
=================== slightly off topic =========
Expecting us to either write, or copy / paste, and quote entire tutorials, to the forum is
absurd, and there is no need to do that.
I am no expert at all, and to be honest, I am pretty ignorant about technical details, etc.
It has been pointed out on many occasions, I really don't know very much, about Linux or Debian, and this is true, However I did manage to install what I needed and setup my servers without ever needing to ask anyone here,...How ? by doing a few very simple searches, and reading , reading over again, carefully studying what I found in those searches, also comparing the different methods, and there are many,... I did my research,
and there is no reason some one should have to be asking these kind of questions, if they just do a little research.
It is possible one may encounter some details that require asking, and then one would need to post, including some details about the specific problem, perhaps a configuration file, or something.
I know, this another "to long to read", and not likely the OP will bother reading, nor reading any of the available documentation and tutorials, but then again someone else
trying to really do some research might stumble on to this thread when they do searches.
So any way, I will close this with a list of the tutorials I found most useful.
One last note though, on Debian 7 server, I used the Apache web server, instead of nginx, but that does not matter, the tutorials are available for both.
It is VERY important in either one, to look at the documentation that comes with the installation, in the docs, read the "README" files, there are some specific to Debian as well.
=========================== end of rant ========
List:
https://www.vultr.com/docs/setup-up-nginx-php-fpm-and-mariadb-on-debian-8
===========
https://www.atlantic.net/community/howto/install-lemp-on-debian-8/
===========
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-8
==============
Apology, since I used Apache, most of the tutorials I have are for apache, not nginx.
It is important to note, if one wants to use Nginx, it is best to remove all the Apache packages first, often Apache or Apache 2 is installed by default on Debian,
In any event, after installing nginx, the Apache server needs to be stopped first,
before starting the nginx server:
Code: Select all
# service apache2 stop

====
Code: Select all
#systemctl start nginx

=====
Most of the tutorials recommend installing "sudo", I don't, I do not use it, and prefer
just using "su", if the OP does not understand, and know the difference, they need to research that first and decide.
Unlike other Linux distributions, Debian 8 does not come with sudo installed.

It is something from "Ubuntu", I think, but any way I do not use it , nor have installed
on any of my systems. It is easy enough to adjust, where the tutorials say "sudo"
, instead, one must run the command as root, "su" is the command to login as root,
after you are done "exit", takes you back to being a normal user.
Ok, well I have wasted enough time, and got bored with this...
User avatar
GarryRicketson
 
Posts: 4118
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How to update specific package such as nginx

Postby GarryRicketson » 2017-08-05 16:11

More important, PLEASE:
show us what your
Code: Select all
/etc/apt/sources.list

has in it.

That may be a important factor.
User avatar
GarryRicketson
 
Posts: 4118
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How to update specific package such as nginx

Postby kedaha » 2017-08-05 18:07

aliweb wrote:But what if I only want to install nginx and nothing else? As I understand this update command updates every package (or the available ones) and many of them I won't be needing I guess. So is there a way to install just specific software like nginx?

Well, just to answer your question: Yes, a specific package can be downloaded using apt and then installed as root with dpkg -i.
The command apt-get download will download the package to your working directory.
For example, on my stable system:
Code: Select all
user@debian:~$ mkdir packages && cd packages
user@debian:~/packages$ apt-get download nginx
Get:1 http://ftp.es.debian.org/debian stretch/main amd64 nginx all 1.10.3-1+deb9u1 [81.5 kB]
Fetched 81.5 kB in 0s (387 kB/s)
user@debian:~/packages$ ls
nginx_1.10.3-1+deb9u1_all.deb

But of course, installing the single package as root with
Code: Select all
# dpkg -i nginx_1.10.3-1+deb9u1_all.deb

would result in an unconfigured "broken package" due to multiple missing dependences which the following command would normally fix:
Code: Select all
# apt --fix-broken install

Unless your system is really broken somewhere on account of extraneous software sources, which is why you've been asked to post your /etc/apt/sources.list. You shouldn't look for workarounds; it's much better to let apt or preferably aptitude handle everything, which it'll do unless there's a spanner in the works.
Desktop: Mate with Open Sound System (OSSv4].
Server: LaMp, WordPress; mail server set up as detailed at ispmail.
Debian Stable & Software
Do one thing & do it well.[/size]
User avatar
kedaha
 
Posts: 2681
Joined: 2008-05-24 12:26

Re: How to update specific package such as nginx

Postby aliweb » 2017-08-05 18:59

GarryRicketson wrote:It is very obvious the OP is not making any effort to research their project, other then asking here, there are plenty of good tutorials available that go into step by step details.
But before even thinking about installing nginx, myssql, php, etc. it would be much better
to learn a little just about Debian, package installation, configuration ,etc.
If the OP simply must have the shiniest newest version of nginx, they will need to download it, and install, it will not be available in the Debian repositories, I don't care how
many times they run 'apt-update' or upgrade etc,...
Before deciding to use the shiniest ,newest version, the OP should read:
https://wiki.debian.org/DontBreakDebian

Then :
from:https://www.linode.com/docs/web-servers/nginx/install-nginx-web-server-on-debian-8
Install nginx
From Debian Repositories
The simplest way to install nginx on a server is to download it from Debian’s repositories.
Install nginx and start the daemon:
Code: Select all
 sudo apt-get install nginx

Installing nginx from the Debian repositories ensures that nginx has been tested and will optimally run on Debian. However, Debian repositories are often a few versions behind the latest nginx release.
Nginx can be tested by navigating to your FQDN in your browser. The default nginx page should be present.

The same tutorial, above, also goes into how to install it , from the nginx site, and install the shiniest newest version, BUT I strongly do not recommend that.
If the OP does not like the particular tutorial I linked to, there are many others, as pointed out by Dasein,..
Just do a simple search, :
How to instal nginx on Debian 8
=================== slightly off topic =========
Expecting us to either write, or copy / paste, and quote entire tutorials, to the forum is
absurd, and there is no need to do that.
I am no expert at all, and to be honest, I am pretty ignorant about technical details, etc.
It has been pointed out on many occasions, I really don't know very much, about Linux or Debian, and this is true, However I did manage to install what I needed and setup my servers without ever needing to ask anyone here,...How ? by doing a few very simple searches, and reading , reading over again, carefully studying what I found in those searches, also comparing the different methods, and there are many,... I did my research,
and there is no reason some one should have to be asking these kind of questions, if they just do a little research.
It is possible one may encounter some details that require asking, and then one would need to post, including some details about the specific problem, perhaps a configuration file, or something.
I know, this another "to long to read", and not likely the OP will bother reading, nor reading any of the available documentation and tutorials, but then again someone else
trying to really do some research might stumble on to this thread when they do searches.
So any way, I will close this with a list of the tutorials I found most useful.
One last note though, on Debian 7 server, I used the Apache web server, instead of nginx, but that does not matter, the tutorials are available for both.
It is VERY important in either one, to look at the documentation that comes with the installation, in the docs, read the "README" files, there are some specific to Debian as well.
=========================== end of rant ========
List:
https://www.vultr.com/docs/setup-up-nginx-php-fpm-and-mariadb-on-debian-8
===========
https://www.atlantic.net/community/howto/install-lemp-on-debian-8/
===========
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-debian-8
==============
Apology, since I used Apache, most of the tutorials I have are for apache, not nginx.
It is important to note, if one wants to use Nginx, it is best to remove all the Apache packages first, often Apache or Apache 2 is installed by default on Debian,
In any event, after installing nginx, the Apache server needs to be stopped first,
before starting the nginx server:
Code: Select all
# service apache2 stop

====
Code: Select all
#systemctl start nginx

=====
Most of the tutorials recommend installing "sudo", I don't, I do not use it, and prefer
just using "su", if the OP does not understand, and know the difference, they need to research that first and decide.
Unlike other Linux distributions, Debian 8 does not come with sudo installed.

It is something from "Ubuntu", I think, but any way I do not use it , nor have installed
on any of my systems. It is easy enough to adjust, where the tutorials say "sudo"
, instead, one must run the command as root, "su" is the command to login as root,
after you are done "exit", takes you back to being a normal user.
Ok, well I have wasted enough time, and got bored with this...


Wow I didn't know Debian community is so toxic and butt hurt. People advised me not to ask questions here and rather stick to stackexchange or other sites. I should have listened to them.
aliweb
 
Posts: 22
Joined: 2017-08-04 05:54

Re: How to update specific package such as nginx

Postby aliweb » 2017-08-05 19:02

kedaha wrote:
aliweb wrote:But what if I only want to install nginx and nothing else? As I understand this update command updates every package (or the available ones) and many of them I won't be needing I guess. So is there a way to install just specific software like nginx?

Well, just to answer your question: Yes, a specific package can be downloaded using apt and then installed as root with dpkg -i.
The command apt-get download will download the package to your working directory.
For example, on my stable system:
Code: Select all
user@debian:~$ mkdir packages && cd packages
user@debian:~/packages$ apt-get download nginx
Get:1 http://ftp.es.debian.org/debian stretch/main amd64 nginx all 1.10.3-1+deb9u1 [81.5 kB]
Fetched 81.5 kB in 0s (387 kB/s)
user@debian:~/packages$ ls
nginx_1.10.3-1+deb9u1_all.deb

But of course, installing the single package as root with
Code: Select all
# dpkg -i nginx_1.10.3-1+deb9u1_all.deb

would result in an unconfigured "broken package" due to multiple missing dependences which the following command would normally fix:
Code: Select all
# apt --fix-broken install

Unless your system is really broken somewhere on account of extraneous software sources, which is why you've been asked to post your /etc/apt/sources.list. You shouldn't look for workarounds; it's much better to let apt or preferably aptitude handle everything, which it'll do unless there's a spanner in the works.


Well this whole problem stems from the fact that my understanding about Linux systems is not accurate as I am from Windows background. Your reply has cleared many confusions that I had. Basically I was trying to save as much RAM as I could but I guess this approach is not right as it will result in broken packages. So I will let Debian take care of it.
aliweb
 
Posts: 22
Joined: 2017-08-04 05:54

Re: How to update specific package such as nginx

Postby dasein » 2017-08-05 19:42

aliweb wrote:Wow I didn't know Debian community is so toxic and butt hurt. People advised me not to ask questions here and rather stick to stackexchange or other sites. I should have listened to them.

Just tying two threads together...
viewtopic.php?f=30&t=134184&p=651250#p651250
User avatar
dasein
 
Posts: 7770
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: How to update specific package such as nginx

Postby debiman » 2017-08-08 06:31

aliweb wrote:But what if I only want to install nginx and nothing else?

since you are using debian 8 aka jessie aka oldstable, i think it's safe to say that you absolutely definitely should keep ALL packages as up-to-date as possible.

in your other thread there was a problem with your sources, iirc? i think we need to fix that.

meanwhile, familiarize your self with the apt and apt-get commands, esp
apt(-get) update
apt(-get) upgrade
apt(-get) install

and also

apt search
or
apt-cache search

PS:
please don't judge the distro by its forum...
User avatar
debiman
 
Posts: 1086
Joined: 2013-03-12 07:18

Re: How to update specific package such as nginx

Postby aliweb » 2017-08-08 12:22

debiman wrote:
aliweb wrote:But what if I only want to install nginx and nothing else?

since you are using debian 8 aka jessie aka oldstable, i think it's safe to say that you absolutely definitely should keep ALL packages as up-to-date as possible.

in your other thread there was a problem with your sources, iirc? i think we need to fix that.

meanwhile, familiarize your self with the apt and apt-get commands, esp
apt(-get) update
apt(-get) upgrade
apt(-get) install

and also

apt search
or
apt-cache search

PS:
please don't judge the distro by its forum...


I actually like Debian. I have never used Linux before and when it came to choosing distro for my VPS, I read articles, comparisons, blog between CentOS, Ubuntu and Debian and came to the conclusion this will be best suited to my needs because it is one of the most stable and secure distro as well as it consumes less memory than others.
aliweb
 
Posts: 22
Joined: 2017-08-04 05:54

Re: How to update specific package such as nginx

Postby pylkko » 2017-08-08 19:12



Wow I didn't know Debian community is so toxic and butt hurt. People advised me not to ask questions here and rather stick to stackexchange or other sites. I should have listened to them.


If there is anything I can do to help you actually do something about you realization and go to stack overflow, please let me know. I bet people there will be really nice to you.
User avatar
pylkko
 
Posts: 1001
Joined: 2014-11-06 19:02

Re: How to update specific package such as nginx

Postby sunrat » 2017-08-09 10:38

pylkko wrote:I bet people there will be really nice to you.

Code: Select all
div {
forreals: no;
srsly: rllyno;
}

:lol:
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 1958
Joined: 2006-08-29 09:12
Location: Melbourne, Australia


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable