Skip to content

RPM and Debian common tasks for lpic1

Debian

Install, upgrade and uninstall Debian binary packages.

	Install

		dpkg -i ./vim3.3-3.deb
		apt-get install vim
		
		install
			Install or upgrade one or more packages by name.
		
	Upgrade

		Upgrading a package is no different from installing one. However, you should use the -G option
		when upgrading with dpkg to ensure that the installation won’t proceed if a newer version of
		the same package is already installed.
		
		dist-upgrade
			Upgrade automatically to new versions of Debian Linux.
		
		update
			Fetch a list of currently available packages. This is typically done before any changes are
			made to existing packages.
		
		upgrade
			Upgrade a system’s complete set of packages to current versions safely. This command is
			conservative and will not process upgrades that could cause a conflict or break an existing
			configuration; it also will not remove packages.

	Uninstall
		
		dpkg -r elvis 
		dpkg --purge elvis

		remove
		Remove specified packages.

		
	Obtain package information like version, content, dependencies, package integrity and installation status 
	(whether or not the package is installed).
		
		dpkg -s apt

		
		List the installed packages using dpkg -l; if you don’t specify a pattern, all packages will be listed:
		
			# dpkg -l xdm

		Use  dpkg -S to determine the package from which a particular file was installed with the filename:
		
			# dpkg -S /usr/bin/nl
	
	
	Important files/commands
	
	    /etc/apt/sources.list
		
		dpkg
		
		dpkg-reconfigure
			reconfigure an already installed package
			
		apt-get
		
		apt-cache
			query the APT cache

			   gencaches - Build both the package and source cache
			   showpkg - Show some general information for a single package
			   showsrc - Show source records
			   stats - Show some basic statistics
			   unmet - Show unmet dependencies
			   search - Search the package list for a regex pattern
			   depends - Show raw dependency information for a package
			   rdepends - Show reverse dependency information for a package
			   pkgnames - List the names of all packages in the system
		
		aptitude
			install
			remove
			purge
			hold
			unhold
			keep
			reinstall
			update
			full-upgrade
			search
			
			
	
		
RPM

	Install, re-install, upgrade and remove packages using RPM and YUM.

		Install
			
			rpm -i binutils-2.11.93.0.2-11.i386.rpm cpp-2.96-113.i386.rpm \
					glibc-devel-2.2.5-44.i386.rpm gcc-2.96-113.i386.rpm
					
			rpm -ih gcc-2.96-113.i386.rpm -- with hash
			
			yum install samba
			
		Upgrade
			
			rpm -U gcc-2.96-113.i386.rpm
			
			yum check-update
			
		Remove Packages
			
			yum remove httpd
			
			rpm -e glibc-devel
			
			--nodeps
				
				Skip dependency testing
				
			--test
			
				Runs through the motions except actually uninstalling

	Obtain information on RPM packages such as version, status, dependencies, integrity and signatures.

		Check installed Pacackages with list
			yum list
		
		Collect information about a particular package
			yum info httpd
		
		List the packages that have been installed on the system:
			# rpm -qa
			
		Verify Mode
		
			Files from installed packages can be compared against their expected configuration from the
			RPM database by using rpm -V.
			
			Frequently used verify options
			
				--nofiles
					Ignores missing files.
				
				--nomd5
					Ignores MD5 checksum errors.

				--nopgp
					Ignores PGP checking errors.
		
		
	Determine what files a package provides, as well as find which package a specific file comes from.
	
		Determine what package a particular file was installed from. Of course, not all files originate from packages:
			# rpm -qf /etc/aliases
			sendmail-8.11.6-15
				
		List the files contained in a package:
			# rpm -qlp gnucash-1.3.0-1.i386.rpm
		
		-q query mode
		-l List all of the files contained in package. When used with -p, the package is a filename.
		-p option and specify a package name instead of a package filename
		
		
	Important files/commands

		rpm
		rpm2cpio
			Extract cpio archive from RPM Package Manager (RPM) package
			rpm2cpio rpm-1.1-1.i386.rpm
		
		/etc/yum.conf	
			YUM is configured through the  /etc/yum.conf configuration file.
			
		/etc/yum.repos.d/
			Repositories may be added and modified through the /etc/yum.repos.d directory
		
		yumdownloader
			is a program for downloading RPMs from Yum repositories.
				Download the kernel RPM to /var/tmp:
					yumdownloader --destdir /var/tmp kernel

			    List the URL for the kernel and kernel-smp RPMs:
					yumdownloader --urls kernel kernel-smp


Advertisements

Samba permissions on Mac os Snow Leopard Server

I spent some time on making a Samba server that acted weirdly randomly work properly like a normal windows share with write access. Here’s the config


[Share_Name]
comment = Some comments
path = /Users/Path
available = yes
guest ok = no
readonly = no
writeable = yes
inherit permissions = no
create mask = 0777
force create mode = 0777
directory mask = 777
read only = no

Mac Os Snow Leopard Server Notes #1

Welcome message
	/etc/motd

Bash login script
	/etc/bashrc
	
	Tricks
		To fix the mac/windows keyboard issues, add to /etc/bashrc
			TERM=linux
		
		To make ports universally accessible add to /etc/bashrc
			export PATH=$PATH:/opt/local/bin
			export MANPATH=$MANPATH:/opt/local/share/man
			export INFOPATH=$INFOPATH:/opt/local/share/info

Server configuration files
	/private/etc/hosts
	/private/etc/php.ini
	/private/etc/my.cnf
	/private/etc/apache2/httpd.conf
	/private/var/log/apache2
			
Update locate db
	sudo /usr/libexec/locate.updatedb

Ports
	Show outdated packages
		port outdated
	Update to the latest trees
		sudo port selfupdate

	Search for package
		port search apache2
	See more info on a package
		port info php5-mcrypt
	See variations of a package
		port variants nmap
		port installed
	See dependencies of a package	
		port deps apache2
	Install the default package of a package
		sudo port install nmap
	Install a variation of a package
		sudo port install fetchmail +ssl
	If you screw things up while installing, clean them up
		sudo port clean --all vile
	Uninstall a package
		sudo port uninstall vile
	Upgrade an existing package
		sudo port upgrade gnome
		
Rebooting and shutdown
	halt
	reboot

Mac Mini Server Review

I bought a Mac Mini Server,

Unless you are a multi-talented computer genius it’s often better to buy a prepacked computer rather than assembling your own, here is why

  1. You are not a hardware genius, unless you don’t do anything else with computers other than building them, you don’t follow the hardware industry’s news everyday, so you don’t know what works best and what works best with what, but people who make these computers at giant companies like Apple, HP, Dell and etc do this for living and know their stuff much better than you who happen to be a graphic designer, web developer, programmer, system administrator, gamer, or an average computer user. So the parts and configurations they choose usually works better!
  2. You are not a System Administration genius either, you don’t know which server editions, and which configurations works best for your operating system and for your hardware. It will take a lot of time for you to build a complete server that works,  and works well as a system! Again the giant companies do have experts who know these stuff and have often are the creator of server software.
  3. Sorry, but you are not a security genius either, giant companies have those guys as well!

Buy buying a prepacked and pre-installed server you are actually hiring a whole group of professionals to assemble your server for you. Unless you think you know better than them, you probably are far safer buying a complete server, and then modifying the software and settings a little bit to suit your needs.

How about economy? We all love money and we hate to pay less, and receive more, what’s more important than economy? love? yeah right!

Well, my server after taxes, with a three year apple care, costs about $1300, think about it, it’s 13 gorgeous little baby one hundred dollar bills! with that I could go to dollar store and buy exactly 1000 useless things, but I made the wise decision not to. They also gave me a free $100 iTunes gift card which I’m gonna use for buying self help audio books, and an unlimited one to one training with apple nerds. I didn’t find this latter offer to be very useful for me, because the apple nerds can’t probably help me with what I want, they will teach you how to send emails and stuff, or how to make podcasts!

The server software itself costs $400. The one thing I don’t like about this server is its CPU, it’s only a 2.66GHz Intel Core 2 Duo, which I think I bought one in 2006ish, I’m trying to ignore this bitter reality. I couldn’t complain about the performance of the server though, I thought it would be “Mac Slow Leopard”, but it’s not. you’ll be safe to imagine you are running a 6 core CPU, if you are not doing anything hardcore, besides Apple almighty knows best, maybe a better CPU wouldn’t work in this small pack of awesomeness, Computer companies works in mysterious ways.

So with this amount of beautiful dollars, I could buy a kick ass hardware, then install free Ubuntu Server on it, but I chose not to, because I’m not any of the three experts mentioned earlier. I just want something that works and keeps working relatively well.

The machine itself is amazing, with no doubt it is the most modern piece of technology I have in my house, it’s as big as an external hard disk, It doesn’t make ANY noise, and it will chill in a little corner of my bedroom working constantly for the next three years. Plus I’ve connected this “server” to my TV using an expensive HDMI cable, I’m gonna download torrents, and what netflix with this. Youtube’s 1080p HD videos show up seamlessly on the large screen TV, I’m gonna buy a Magic Trackpad  and the keyboard, and soon my bedroom will be every man’s dream minus a permanent soul mate.

The server software is also amazing, it comes with almost anything a developer would need,  Apache, PHP, Python, Mysql, Samba, bla bla bla. I added  zend framework, xdebug, and moved my mysql databases, placed my log files in my favorite places,  in around 2 hours. What’s left to be done is to do GGG (Get Git Going), and I will have my perfect development environment ready to work in only 2 days since I decided to buy this Mac.

I have to say I had some difficulty with Apple’s people though, I have a Mac Book that I laser beamed it’s Mac OS Leopard. Long story when Windows 7 came out, I had to have it because I was doing some .net work for someone, Mac OS didn’t support co-existence with Win 7 at the beginning so I had to make the executive decision of saying goodbye to Mac Os, hence I removed any trace of Apple software from this Macbook. Now the Win 7 got pretty screwed up after about a year, so now that I’m reinstalling Win 7, I’d like to have Mac OS back too.

The when I was gonna buy the Apple Snow Leopard upgrade from apple store, the nerdy looking guy over there told me you don’t need this. Your server comes with a Disc that you can use to install the OS on your laptop for free as well, I was shocked! So apple doesn’t care about licensing and stuff anymore? I asked him several times, he said he is sure, but it turns out he was deadly wrong.

So I called Apple, they told me the nerd at the store was wrong, you need to buy the upgrade disc.

I went back to the store, met a new nerdy looking girl, and she told me she works at Apple store so she knows best, and she knows an upgrade disc would not be enough since I have no trace of Mac Os left, I would have to call apple and get the same disc that came with my laptop and I lost.

I was thinking ok, so if I buy this and it doesn’t work I can return it right? She said no, not if you open it. Then I thought ok I’m gonna buy this, if it didn’t work, I’ll call Apple, get the old cd, install, and then upgrade using this disc so I need this disc anyways, but that’s just because I thought I could use my gift card for the $30 disc, but I was wrong it could only be used in itunes, so I didn’t buy the upgrade disc.

Why all this madness? It’s understandable, Apple people don’t deal with these kind of issues everyday, most of their clients are people who do normal average stuff, not too many people go and remove everything Apple from their Apple macbook. But that doesn’t justify it, they should know that they don’t know and stop giving non-working advice.

So overall, it’s good product and I recommend it.

Xdebug under wamp with netbeans

This is finally the php.ini configuration for xdebug that worked for me.

You have no idea how much I’ve been through for getting this damned but useful thing work.

[xdebug]
zend_extension = "C:\wamp\bin\php\php5.3.0\ext\php_xdebug-2.1.0-5.3-vc6.dll"
xdebug.profiler_output_dir = "c:\wamp\tmp\xdebug"
xdebug.profiler_output_name = "cachegrind.out.%p"
xdebug.profiler_enable =1
xdebug.profiler_append=1
xdebug.extended_info=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_log="c:\wamp\tmp\xdebug\xdebug_remote.log"
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0

And here is my Netbeans configurations:

how to add classes to a Zend Framework project

You always have classes written from before that you want to reuse in your projects, Zend has made it a bit harder to get them running but when you get your classes, to work, everything goes very well.

You might have noticed when you add a new class, your IDE may recognize it, but when you run your project on apache it is not recognized.

There are a few things you need to do in order to have your classes run under your project.

1- File structure and naming

If your class name is “Class_DB_Repair” then it should be stored in a file named Repair.php in “Class\DB\” folder.

2- Put your “Class” folder or any other folder that is the root of all your classes somewhere nice, I usually put them all in “library”.

3-Add this to your public/index.php

$Zend_Loader_Autoloader = Zend_Loader_Autoloader::getInstance();
$Zend_Loader_Autoloader->setFallbackAutoloader(true);
$Zend_Loader_Autoloader->registerNamespace(array(‘Class_’));

4-I’m not sure if this is necessary or not but you can add this to application.ini too

includePaths.Ycode = APPLICATION_PATH “/../library/Class”

How to setup xdebug on wamp

This is what worked for me:

[xdebug]
zend_extension=”C:/wamp/bin/php/php5.3.0/ext/php_xdebug-2.0.5-5.3-vc6.dll”
xdebug.profiler_output_dir = “c:/wamp/tmp/xdebug”
xdebug.profiler_output_name = “cachegrind.out.%p”
xdebug.profiler_enable = 0
xdebug.profiler_append=0
xdebug.extended_info=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=xdebug
xdebug.remote_log=”c:/wamp/tmp/xdebug/xdebug_remot.log”
xdebug.show_exception_trace=0
xdebug.show_local_vars=9
xdebug.show_mem_delta=0
xdebug.trace_format=0

Edit the phi.ini that appears on PHP->PHP.ini when you right click on wamp, and get the appropriate dll file as listed