Cannot install packages on FreeBSD 9.2

Dear All,

I am new to FreeBSD and I got some issues about the system. I use the version 9.2. Here is the problem.

I already give the user root privilege. However, whenever I type:
# pkg install curl

It says:
Code:
pkg: Insufficient privileges to install packages
.

Then I switch to root by typing su. And re-type: # pkg install curl
But it still does not work and the system prints out:
Code:
Updating repository catalogue

Then the system stopped and nothing happened.

I search the web for nearly half a day. And I try to use sudo. BUT it still says
Code:
Updating repository catalogue
. x(

Does anyone know what is going on? Great, great thanks for your help.

Thanks.
 
You must switch to root user to install packages, with su or sudo. What did you do to "give the user root privilege"?
Code:
Updating repository catalogue
can take a long time. How long do you wait? Can you ping the repository? The default repository is at pkg.FreeBSD.org, so try this: ping pkg.FreeBSD.org
 
ljboiler said:
You must switch to root user to install packages, with su or sudo. What did you do to "give the user root privilege"?
"Updating repository catalogue" can take a long time. How long do you wait? Can you ping the repository? The default repository is at pkg.FreeBSD.org, so try this: ping pkg.FreeBSD.org

Great, thanks for you notes. I have switched to the root user. It says
Code:
updating repository catalogue
and then stops. Nothing changed. I install sudo on the system and give all rights to the user. Yes, I can ping it. But I still cannot install packages.

Thanks.
 
ShelLuser said:
How exactly did you install pkgng? Because depending on your initial situation it can require several specific steps.

Thanks for your note.

I install it by first switching to root user. Then cd /usr/ports/ports-mgmt/pkg, then make install clean.

pkg is successfully installed. But I cannot use pkg to install packages.

Then I google the problem and also run pkg2ng command. But it does not work.

Thanks.
 
zhuotaoliu said:
I install it by first switching to root user. Then cd /usr/ports/ports-mgmt/pkg, then make install clean.

pkg is successfully installed. But I cannot use pkg to install packages.
But did you also run pkg2ng and remember to edit /etc/make.conf (this won't be a requirement if you're not going to use the Ports collection but will only be using binary packages).

On FreeBSD 9.2 there already is a packaging system in place (the so called pkg_* tools) and just installing pkg won't be enough; you'll have to start by converting your old package database to the new format. Next, if you want to use the repositories, you'll also have to configure pkgng.

Check /usr/local/etc/pkg.conf.sample. You'll probably want to copy that as pkg.conf and then edit it so that it matches your environment. Also pay close attention to pkg.conf(5) (in my opinion this sample configuration file is pretty poorly done, the manualpage provides better examples).

Also note that you'll actually need 2 files; the configuration file (as mentioned here) and a so called repository configuration file. This is an entry in the directory specified by repos_dir (in pkg.conf) and it points pkgng to a package repository which it can use.

After you set all that up then I'm pretty sure that this will start working.
 
ShelLuser said:
zhuotaoliu said:
I install it by first switching to root user. Then cd /usr/ports/ports-mgmt/pkg, then make install clean.

pkg is successfully installed. But I cannot use pkg to install packages.
But did you also run pkg2ng and remember to edit /etc/make.conf (this won't be a requirement if you're not going to use the Ports collection but will only be using binary packages).

On FreeBSD 9.2 there already is a packaging system in place (the so called pkg_* tools) and just installing pkg won't be enough; you'll have to start by converting your old package database to the new format. Next, if you want to use the repositories, you'll also have to configure pkgng.

Check /usr/local/etc/pkg.conf.sample. You'll probably want to copy that as pkg.conf and then edit it so that it matches your environment. Also pay close attention to pkg.conf(5) (in my opinion this sample configuration file is pretty poorly done, the manualpage provides better examples).

Also note that you'll actually need 2 files; the configuration file (as mentioned here) and a so called repository configuration file. This is an entry in the directory specified by repos_dir (in pkg.conf) and it points pkgng to a package repository which it can use.

After you set all that up then I'm pretty sure that this will start working.


Great thanks for your help.
I only copy the /usr/local/etc/pkg.conf.sample to /usr/local/etc/pkg.conf. And then it starts working.
Thanks very much for your help.

I am going to close this issue.
 
Back
Top