# Recommended Upgrade Process / Webserver



## kutu62 (Jan 22, 2010)

I was wondering what upgrade process is being used by y'all here.

Running freeBSD 8 as a production webserver, what process would you recommend using?

Right now I follow these steps:

(1) # portsnap fetch update 
(2) pkg_version -vL= 
(3) portupgrade -a 

This seems to be overkill.. most of the time spent is D/L of the docbooks. Can I exclude the docbooks so save time and space?

Is this the process everyone else is using to stay up to date?

Thanks


----------



## LateNiteTV (Jan 22, 2010)

to update installed ports, i use portmaster. 
to update the base system i use the csup + buildworld process.


----------



## dennylin93 (Jan 25, 2010)

kutu62 said:
			
		

> I was wondering what upgrade process is being used by y'all here.
> 
> Running freeBSD 8 as a production webserver, what process would you recommend using?
> 
> ...



What ports did you install? There shouldn't be any ports that require docbooks on a web server.

However, you can exclude them by using -x in portmaster: `# portmaster -a -x docbook`. There should be a similar option for portupgrade.


----------



## kutu62 (Jan 25, 2010)

dennylin93 said:
			
		

> What ports did you install? There shouldn't be any ports that require docbooks on a web server.



Dont look to bad, I think I need all those to run FAMP... if I could just remove those -doc- I'd be all set. Is there away to remove -doc- completely?

Currently studying up on all the different ways to update a freebsd system - seems like a lot of options.. 


```
# portmaster -L
===>>> Root ports (No dependencies, not depended on)
===>>> bigreqsproto-1.0.2
===>>> bn-freebsd-doc-20100120
===>>> da-freebsd-doc-20100120
===>>> de-freebsd-doc-20100120
===>>> el-freebsd-doc-20100120
===>>> en-freebsd-doc-20100120
===>>> es-freebsd-doc-20100120
===>>> fr-freebsd-doc-20100120
===>>> hu-freebsd-doc-20100120
===>>> inputproto-1.5.0
===>>> it-freebsd-doc-20100120
===>>> ja-freebsd-doc-20100120
===>>> libcheck-0.9.8
===>>> libtool-2.2.6b
===>>> mn-freebsd-doc-20100120
===>>> nl-freebsd-doc-20100120
===>>> pl-freebsd-doc-20100120
===>>> portmanager-0.4.1_9
===>>> portmaster-2.16
===>>> pt-freebsd-doc-20100120
===>>> ru-freebsd-doc-20090913
        ===>>> New version available: ru-freebsd-doc-20100120
===>>> sr-freebsd-doc-20100120
===>>> tr-freebsd-doc-20100120
===>>> unzip-6.0
===>>> xcmiscproto-1.1.2
===>>> xf86bigfontproto-1.1.2
===>>> xorg-macros-1.2.1
===>>> zh_cn-freebsd-doc-20100120
===>>> zh_tw-freebsd-doc-20100120
===>>> 29 root ports

===>>> Trunk ports (No dependencies, are depended on)
===>>> adobe-cmaps-20051217_1
===>>> amspsfnt-1.0_5
===>>> autoconf-wrapper-20071109
===>>> automake-wrapper-20071109
===>>> cmpsfont-1.0_6
===>>> db41-4.1.25_4
===>>> docbook-xsl-1.75.2
===>>> expat-2.0.1_1
===>>> freetype-1.3.1_4
===>>> gsfonts-8.11_5
===>>> html2text-1.3.2a
===>>> jbigkit-1.6
===>>> jpeg-7
===>>> kbproto-1.0.3
===>>> libiconv-1.13.1
===>>> libltdl-2.2.6b
===>>> libmcrypt-2.5.8
===>>> libpaper-1.1.23+nmu1
===>>> libsigsegv-2.5
===>>> libwww-5.4.0_4
===>>> links-0.98,1
===>>> mysql-client-5.1.42
===>>> pcre-8.00
===>>> pdflib-7.0.4
===>>> perl-5.8.9_3
===>>> pkg-config-0.23_1
===>>> png-1.2.42
===>>> printproto-1.0.4
===>>> python26-2.6.4
===>>> ruby+oniguruma-1.8.7.248,1
===>>> scr2txt-1.2
===>>> t1utils-1.32
===>>> tex-texmflocal-1.9
===>>> tidy-20000804_2
===>>> xbitmaps-1.0.1
===>>> xextproto-7.0.5
===>>> xmlcatmgr-2.2
===>>> 37 trunk ports

===>>> Branch ports (Have dependencies, are depended on)
===>>> apache-2.2.14_5
===>>> autoconf-2.62
===>>> cm-super-0.3.4_1
===>>> cups-client-1.4.2_3
===>>> cups-image-1.4.2_3
===>>> docbook-4.1_3
===>>> docbook-xml-4.2_1
===>>> dsssl-docbook-modular-1.79_1,1
===>>> dvipdfmx-20090522_2
===>>> dvipsk-tetex-5.95a_3
===>>> fixrtf-0.1.20060303
===>>> fontconfig-2.8.0,1
===>>> freetype-tools-1.3.1_6
===>>> freetype2-2.3.11
===>>> gd-2.0.35_2,1
===>>> gettext-0.17_1
===>>> ghostscript8-8.70
===>>> gnutls-2.8.3
===>>> html-4.01_2
===>>> iso8879-1986_2
===>>> jade-1.2.1_9
===>>> jadetex-3.13_4
===>>> latex-cjk-4.8.2_2
===>>> libICE-1.0.4_1,1
===>>> libSM-1.1.0_1,1
===>>> libX11-1.2.1_1,1
===>>> libXau-1.0.4
===>>> libXaw-1.0.5_1,1
===>>> libXdmcp-1.0.2_1
===>>> libXext-1.0.5,1
===>>> libXmu-1.0.4,1
===>>> libXp-1.0.0,1
===>>> libXpm-3.5.7
===>>> libXt-1.0.5_1
===>>> libfontenc-1.0.4
===>>> libgcrypt-1.4.4
===>>> libgpg-error-1.7
===>>> libpthread-stubs-0.3_3
===>>> libxcb-1.5
===>>> libxml2-2.7.6_1
===>>> libxslt-1.1.26
===>>> linuxdoc-1.1_1
===>>> m4-1.4.13,1
===>>> mkfontdir-1.0.4
===>>> mkfontscale-1.0.6
===>>> netpbm-10.26.63_1
===>>> open-motif-2.2.3_6
===>>> p5-XML-Parser-2.36_1
===>>> p5-gettext-1.05_2
===>>> pecl-pdflib-2.1.6_1
===>>> peps-2.0_2
===>>> php5-5.2.12
===>>> php5-bz2-5.2.12
===>>> php5-ctype-5.2.12
===>>> php5-filter-5.2.12
===>>> php5-gd-5.2.12
===>>> php5-mbstring-5.2.12
===>>> php5-mcrypt-5.2.12
===>>> php5-mysql-5.2.12
===>>> php5-mysqli-5.2.12
===>>> php5-openssl-5.2.12
===>>> php5-pcre-5.2.12
===>>> php5-session-5.2.12
===>>> php5-simplexml-5.2.12
===>>> php5-spl-5.2.12
===>>> php5-zip-5.2.12
===>>> php5-zlib-5.2.12
===>>> ruby18-bdb-0.6.5_1
===>>> scr2png-1.2_2
===>>> t1lib-5.1.2_1,1
===>>> teTeX-3.0_2
===>>> teTeX-base-3.0_18
===>>> teTeX-texmf-3.0_6
===>>> texi2html-1.82,1
===>>> tiff-3.9.2
===>>> ttf2pt1-3.4.4_2
===>>> xdvik-tetex-22.84.16
===>>> xhtml-1.0.20020801_4
===>>> xmlcharent-0.3_2
===>>> xproto-7.0.15
===>>> zh-arphicttf-2.11_2
===>>> zh-docproj-0.1.20060303_2
===>>> zh-ttfm-0.9.5_3
===>>> 83 branch ports

===>>> Leaf ports (Have dependencies, not depended on)
===>>> automake-1.10.1
===>>> docproj-jadetex-1.17_2
===>>> docproj-nojadetex-1.17_2
===>>> gmake-3.81_3
===>>> help2man-1.36.4_3
===>>> mysql-server-5.1.42
===>>> p5-type1inst-0.6.1_5
===>>> phpMyAdmin-3.2.5
===>>> portupgrade-2.4.6_3,2
===>>> xcb-proto-1.6
===>>> xtrans-1.2.3
===>>> zh-ttf2pt1-3.4.0
===>>> 12 leaf ports

===>>> 161 total installed ports
        ===>>> 1 has a new version available
#
```


----------



## DutchDaemon (Jan 25, 2010)

[cmd=]pkg_delete freebsd-doc-\*[/cmd] should be enough. Maybe you'll have to force (-f). First run a pkg_info -R on one of them (e.g. [cmd=]pkg_info -R mn-freebsd-doc-20100120[/cmd]), and find the port that pulls all of these docs in. I've never seen them being installed, so it must be a setting you made in one of your other ports' options. Make sure you remove that option, or these ports will simply be reinstalled next time.


----------



## SirDice (Jan 25, 2010)

Next time, try building graphics/gd with the WITHOUT_X11 flag. That will prevent it depending on all sorts of Xorg libraries. Most of the time you don't need them. It's the Xorg libraries that pull in those docbooks.


----------



## DutchDaemon (Jan 25, 2010)

The docbooks, yes (i.e. docbook-{$version}. I have those. 

But not all of those separate {$language}-freebsd-doc-{$version} ones. Never seen those installed.


----------



## kutu62 (Jan 28, 2010)

As far as upgrading here is what I could find..

Someone please bless this... 

*Update Port Tree*

```
portsnap fetch
portsnap update
```

*Upgrade PORTS*

```
portmaster -L  *list all the installed ports and search for updates
portmaster -a  *installed ports can be upgraded using this
```

*Another way to Upgrade PORTS*

```
portupgrade -a *upgrade all the outdated ports installed on your system
```

*Remove Ports*

```
pkg_delete lsof-4.57
```


----------



## kutu62 (Jan 28, 2010)

a google search portmaster versus portupgrade got me this nice dialog

http://forums.freebsd.org/showthread.php?t=6078

another good resource

http://www.freebsd.org/doc/handbook/ports-using.html


----------



## SirDice (Jan 28, 2010)

One step you should always do before running portmaster -a (or portupgrade -a) and that is to read /usr/ports/UPDATING. Sometimes ports need to be updated in a specific order or manner. The notes in UPDATING will tell you this.


----------



## gilinko (Jan 28, 2010)

My routine is this: 

Update ports(I'm using csup)

```
cd /usr/ports
make update
```
This is the same as issuing "portsnap fetch update"

Read UPDATING

```
more UPDATING
```

Search and update installed ports

```
portmaster -L
portmaster -ad
```
(the -d automatically removes old downloaded distfiles, ie previous versions)


----------



## gkontos (Jan 28, 2010)

What I usually do for my production servers is always install portaudit. That way I always know which ports must be updated.
I also run this from cron:

```
0 3 * * * root portsnap -I cron update && pkg_version -vIL=
```
So that I will know whenever a newer port has been released.
Then finally :

```
portupgrade -rR <port>
```
upgrades the port in question with their corresponding dependencies.
Avoid using the portupgrade -a without the -rR switch. Also on a production environment, like a web server, try to keep only the necessary software installed.

George


----------



## kutu62 (Jan 29, 2010)

gkontos 

very awesome post

cron is a great idea - have the results mailed wouldn't be a bad idea either

many thanks


----------



## gkontos (Jan 29, 2010)

kutu62 said:
			
		

> gkontos
> cron is a great idea - have the results mailed wouldn't be a bad idea either
> many thanks


Actually the results are mailed to root


----------



## kutu62 (Mar 11, 2010)

*expected output?*



			
				gkontos said:
			
		

> What I usually do for my production servers is always install portaudit. That way I always know which ports must be updated.
> I also run this from cron:
> 
> ```
> ...




I have implemented this procedure and I'm getting an error which is documented in the freebsd docs for root: not found

Cron emails me this

```
root: not found
```

so I take root out of the command and I get this "portsnap: not found"

I found some info on root: not found in the BSD docs but I don't understand what it is trying to tell me. Can someone help nudge me?

Many thanks


----------



## DutchDaemon (Mar 11, 2010)

Put the full path to commands (e.g. /usr/sbin/portsnap and /usr/sbin/pkg_version) in that crontab, or put this line at the top:


```
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
```


----------



## kutu62 (Mar 11, 2010)

DutchDaemon said:
			
		

> Put the full path to commands (e.g. /usr/sbin/portsnap and /usr/sbin/pkg_version) in that crontab, or put this line at the top:



Thanks DD that got it.. but I ran into some issues afterward when I set the cron job to run every minute for testing - long story short I had to use this post to correct the portsnap snapshot corrupt

cron was hung into some kind loop even though I removed the job - kill that cron process and stop and start it - works like a charm now.

Thanks again DD..


----------

