Is there anyway to disable/remove apt-get on a debian based server. I'd prefer to use aptitude, and don't want the other users to be installing packages with apt-get, to avoid package/database issues.
5 Answers
There are no issues with people using both tools at the same time. I frequently install things using apt-get or aptitude from the command line or use the curses interface to do security updates. Both apt-get and aptitude are front-ends to libapt-pkg, which deals with the dependency resolving and fetching of packages. libapt-pkg in turn uses dpkg to do the actual package installation. Both dpkg and libapt-pkg does locking in the right place, so that if someone is running aptitude, someone else can't install a package via apt-get until aptitude closes.
Since apt-get auto-dependency support there is no advantage of one tool over the other[0]
[0] except aptitude doesn't have super cow powers.
- 23,151
- 2
- 41
- 71
-
1I see, I was under the impression they were maintaining seperate package databases, thanks for the clarification. – DeadlyCreampuff Oct 06 '09 at 02:52
-
`aptitude` *used to* contain *extra* data about whether a package was *automatically* installed or not, but I hear that's now changed and it's all the same database. – Teddy Oct 11 '09 at 05:44
-
Indeed, hence the comment about apt-get's "auto-dependency" support. – David Pashley Oct 11 '09 at 07:19
The idea that there is no difference between apt-get and aptitude is absurd. Yes, they deal with the same repositories but do so in much different ways. Without getting too much into detail, adding packages is about the same, but if you ever want to remove a package or change things, you cannot mix the two and expect good results.
Search for "aptitude vs apt-get" on your favorite search engine for detailed articles about differences.
That being said, you can add this to your /root/.bashrc file:
alias apt-get="echo 'Please use aptitude on this system.'"
Then:
source /root/.bashrc
There are numerious places that Ubuntu officially suggests using apt-get, rgrep apt-get /usr/lib/python2.6/dist-packages/DistUpgrade
to see it. Removing apt-get, or changing the permissions on it can be problematic for debian utilities that might make the relative safe assumption it is there.
- 2,245
- 10
- 34
- 50
There are plenty of ways you can do it, but the fact that your users are able to install packages implies that they have root-level access.
If they have root, you must remember that anything root can do, root can undo (in this context anyway).
All that being said, I'd say the "safest" way to do it is to delete (but keep a copy of) the sources.list file in /etc/apt.
That way all the different variations of apt-get (like aptitude and who knows what else) will fail to work. It's also (marginally) harder for users to reconstruct that than to undo a "chmod 0" of a specific command.
- 1,614
- 11
- 15
-
It appears that he doesn't mind others installing things, he just wants them to use aptitude only for installs. – Zoredache Oct 05 '09 at 21:36
-
Wow, I totally missed the "I'd prefer to use aptitude" part. My apologies. – DictatorBob Oct 05 '09 at 21:56