Changing my Debian mirror

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

Changing my Debian mirror

Postby ExpertLearner » 2017-04-24 18:05

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.
ExpertLearner
 
Posts: 4
Joined: 2017-04-24 17:48

Re: Changing my Debian mirror

Postby GarryRicketson » 2017-04-24 18:36

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.
"What we expect you have already Done"

Before doing anything, read the Debian documentation:
Debian Documentation
How to ask the smart way
Debian Foro Español
======================
For the Birds
User avatar
GarryRicketson
 
Posts: 4218
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Changing my Debian mirror

Postby Head_on_a_Stick » 2017-04-24 19:33

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.
"Yes Linus, our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6538
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Changing my Debian mirror

Postby ExpertLearner » 2017-04-25 03:40

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?
ExpertLearner
 
Posts: 4
Joined: 2017-04-24 17:48

Re: Changing my Debian mirror

Postby dilberts_left_nut » 2017-04-25 04:11

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...
User avatar
dilberts_left_nut
 
Posts: 4642
Joined: 2009-10-05 07:54
Location: enzed

Re: Changing my Debian mirror

Postby ExpertLearner » 2017-04-25 04:20

Thank you :D :D
ExpertLearner
 
Posts: 4
Joined: 2017-04-24 17:48

Re: Changing my Debian mirror

Postby Head_on_a_Stick » 2017-04-25 05:30

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
"Yes Linus, our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6538
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Changing my Debian mirror

Postby ExpertLearner » 2017-04-25 12:12

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.
ExpertLearner
 
Posts: 4
Joined: 2017-04-24 17:48


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable