Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Changing my Debian mirror

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
ExpertLearner
Posts: 4
Joined: 2017-04-24 17:48

Changing my Debian mirror

#1 Post by ExpertLearner »

My network has slowed down. I found out that it was the server. so i found a better mirror using 'netselect-apt'. But i don't know how to add that to the '/etc/apt/sources.list'. I have tried the cat command but it doesn't seem to work. when i 'apt-get update' the old mirror was not replaced. So i would like know how to change the mirror server.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Changing my Debian mirror

#2 Post by GarryRicketson »

Interesting user name, and welcome to the forum,...
How to edit the sources.list file on Debian
================
1st hit : https://wiki.debian.org/SourcesList
There also is this command :

Code: Select all

man sources.list
It will give you the manual, which is full of details.

In a nut shell, it is simple enough.
To edit the sources.list file and add a new source/mirror to it, or change the
others,.
You must use "su", or "sudo", "gksudu", or something that gives you root privileges,..
'cd' to /etc/apt ,
then use any editor you like, but it is best to use vi or nano (in my opinion),
open the sources.list file, edit as desired, adding the additional mirror, etc.
The above links give more details and some examples of what the source lines
should look like.
When you have finished, and save the file, you do need to run

Code: Select all

apt-get update
or

Code: Select all

apt update
first, to update the sources.
Any way, that is how I edit mine, there may be other ways as well.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Changing my Debian mirror

#3 Post by Head_on_a_Stick »

The current advice is to use deb.debian.org, full details here:

http://deb.debian.org/

I recommend installing apt-transport-https and using the https lines, it works very well in my stretch systems.
deadbang

ExpertLearner
Posts: 4
Joined: 2017-04-24 17:48

Re: Changing my Debian mirror

#4 Post by ExpertLearner »

I am glad. Thanks.
I did try to edit the file /etc/apt/sources.list manually using gedit but it managed to disrupt the whole file, luckily i made a copy of the file before making the changes (so i can revet back). I tried
$ cp /sources.list/etc/apt/sources.list
$ mv /sources.list/etc/apt/sources.list
$ cat /sources.list/etc/apt/sources.list

didn't help either.

I found this and it seemed to work
$ netselect-apt stable -n -o /etc/apt/sources.list

but the usual
#This is a comment
deb http://ftp.us.debian.org/debian/ wheezy main
deb-src http://ftp.us.debian.org/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

deb http://ftp.us.debian.org/debian wheezy-updates main
deb-src http://ftp.us.debian.org/debian wheezy-updates main


was changed into

# Debian packages for stable
deb http://ftp.sg.debian.org/debian/ stable main contrib
# Uncomment the deb-src line if you want 'apt-get source'
# to work with most packages.
# deb-src http://ftp.sg.debian.org/debian/ stable main contrib

# Security updates for stable
deb http://security.debian.org/ stable/updates main contrib


Should i worry about it?

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 13 times
Been thanked: 66 times

Re: Changing my Debian mirror

#5 Post by dilberts_left_nut »

If you're running wheezy (which is oldstable), then yes.
Your new sources.list points to 'stable' - currently jessie and soon to be stretch, so surprise upgrades and likely borkage is in your immediate future. ;)
ExpertLearner wrote:I tried
$ cp /sources.list/etc/apt/sources.list
$ mv /sources.list/etc/apt/sources.list
$ cat /sources.list/etc/apt/sources.list
The file you want to back up and edit is /etc/apt/sources.list - correct paths (and spaces) are required - along with being root (as it is a system file that your regular user should not be messing with:

Code: Select all

$ su
Password: <enter root password>
# cp /etc/apt/sources.list /etc/apt/sources.list.bak
# nano /etc/apt/sources.list
AdrianTM wrote:There's no hacker in my grandma...

ExpertLearner
Posts: 4
Joined: 2017-04-24 17:48

Re: Changing my Debian mirror

#6 Post by ExpertLearner »

Thank you :D :D

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Changing my Debian mirror

#7 Post by Head_on_a_Stick »

If you use this command to edit /etc/apt/sources.list, the file will be checked for errors before saving:

Code: Select all

# apt edit-sources
deadbang

ExpertLearner
Posts: 4
Joined: 2017-04-24 17:48

Re: Changing my Debian mirror

#8 Post by ExpertLearner »

When I did that

Code: Select all

$ apt edit-sources 
it just took me to the editor (i e)it asked me to choose between 3 editors and i chose nano, it opened the sources.list for me.

Post Reply