f1734c3c598ea147d52ffbc9ac66c0ffabbc3cc8
[ikiwiki.git] / docs / newhandbook / environmentquickstart / index.mdwn
1 # DragonFly BSD Quick Start
2 This document describes the DragonFly environment one will find on a newly installed system.
3 [[!toc levels=3 ]]
4
5 ## Disk layout
6
7 If you chose to install on the HAMMER file system during installation you will be left with a system with the following disk configuration:
8
9     # df -h
10     Filesystem                Size   Used  Avail Capacity  Mounted on
11     ROOT                      288G    12G   276G     4%    /
12     devfs                     1.0K   1.0K     0B   100%    /dev
13     /dev/serno/9VMBWDM1.s1a   756M   138M   558M    20%    /boot
14     /pfs/@@-1:00001           288G    12G   276G     4%    /var
15     /pfs/@@-1:00002           288G    12G   276G     4%    /tmp
16     /pfs/@@-1:00003           288G    12G   276G     4%    /usr
17     /pfs/@@-1:00004           288G    12G   276G     4%    /home
18     /pfs/@@-1:00005           288G    12G   276G     4%    /usr/obj
19     /pfs/@@-1:00006           288G    12G   276G     4%    /var/crash
20     /pfs/@@-1:00007           288G    12G   276G     4%    /var/tmp
21     procfs                    4.0K   4.0K     0B   100%    /proc
22
23 In this example
24
25 * `/dev/serno/9VMBWDM1` is the hard disk specified with serial number,
26 * `/dev/serno/9VMBWDM1.s1` is the first slice on the hard disk.
27
28 The disklabel looks at follows
29
30     # disklabel /dev/serno/9VMBWDM1.s1
31
32     # /dev/serno/9VMBWDM1.s1:
33     #
34     # Informational fields calculated from the above
35     # All byte equivalent offsets must be aligned
36     #
37     # boot space:    1044992 bytes
38     # data space:  312567643 blocks # 305241.84 MB (320069266944 bytes)
39     #
40     # NOTE: If the partition data base looks odd it may be
41     #       physically aligned instead of slice-aligned
42     #
43     diskid: e67030af-d2af-11df-b588-01138fad54f5
44     label:
45     boot2 data base:      0x000000001000
46     partitions data base: 0x000000100200
47     partitions data stop: 0x004a85ad7000
48     backup label:         0x004a85ad7000
49     total size:           0x004a85ad8200    # 305242.84 MB
50     alignment: 4096
51     display block size: 1024        # for partition display only
52
53     16 partitions:
54     #          size     offset    fstype   fsuuid
55       a:     786432          0    4.2BSD    #     768.000MB
56       b:    8388608     786432      swap    #    8192.000MB
57       d:  303392600    9175040    HAMMER    #  296281.836MB
58       a-stor_uuid: eb1c8aac-d2af-11df-b588-01138fad54f5
59       b-stor_uuid: eb1c8aec-d2af-11df-b588-01138fad54f5
60       d-stor_uuid: eb1c8b21-d2af-11df-b588-01138fad54f5
61
62
63 The slice has 3 partitions:
64
65 * `a` - for `/boot`
66 * `b` - for swap
67 * `d` - for `/`, a HAMMER file system labeled ROOT
68
69 When you create a HAMMER file system you must give it a label, here the installer labeled it as "ROOT" and mounted it as
70
71     ROOT                      288G    12G   276G     4%    /
72
73 A PFS is a Pseudo File System inside a HAMMER file system. The HAMMER file system in which the PFSes are created is referred to as the root file system. You should not confuse the "root" file system with the Label "ROOT", the label can be anything. It is just that the installer labeled it as ROOT because it is mounted as `/`.
74
75 Now inside the ROOT HAMMER file system you find the installed created 7 PFSes from the `df -h` output above, let us see how they are mounted in `/etc/fstab`:
76
77     # cat /etc/fstab
78
79     # Device                Mountpoint      FStype  Options         Dump    Pass#
80     /dev/serno/9VMBWDM1.s1a         /boot           ufs     rw      1       1
81     /dev/serno/9VMBWDM1.s1b         none            swap    sw      0       0
82     /dev/serno/9VMBWDM1.s1d         /               hammer  rw      1       1
83     /pfs/var                /var            null    rw              0       0
84     /pfs/tmp                /tmp            null    rw              0       0
85     /pfs/usr                /usr            null    rw              0       0
86     /pfs/home               /home           null    rw              0       0
87     /pfs/usr.obj    /usr/obj                null    rw              0       0
88     /pfs/var.crash  /var/crash              null    rw              0       0
89     /pfs/var.tmp    /var/tmp                null    rw              0       0
90     proc                    /proc           procfs  rw              0       0
91
92
93 The PFSes are mounted using a NULL mount because they are also HAMMER file systems. You can read more on NULL mounts here [mount_null(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=mount_null&section=8).
94
95 You don't need to specify a size for the PFSes like you do for logical volumes inside a volume group for LVM. All the free space in the root HAMMER file system is available to all the PFSs. That is the reason in the `df -h` output above you saw free space is same for all PFSes and the root HAMMER file system.
96
97 Now if you look in `/var`
98
99     # cd /var/
100     # ls
101     account   backups   caps   cron    empty   log   msgs   run   spool   yp  at        
102     cache     crash     db     games   lib     mail  preserve   rwho  tmp
103
104 you will find the above directories.
105
106 If you look at the status of one of the PFSes, e.g. `/usr` you will see `/var/hammer` is the default snapshot directory.
107
108     # hammer pfs-status /usr/
109     /usr/   PFS #3 {
110         sync-beg-tid=0x0000000000000001
111         sync-end-tid=0x0000000117ac6270
112         shared-uuid=f33e318e-d2af-11df-b588-01138fad54f5
113         unique-uuid=f33e31cb-d2af-11df-b588-01138fad54f5
114         label=""
115         prune-min=00:00:00
116         operating as a MASTER
117         snapshots directory defaults to /var/hammer/<pfs>
118     }
119
120 There is no "hammer" directory in `/var` now. That is because no snapshots are yet taken. You can verify this by checking the snapshots available for `/usr`
121
122     # hammer snapls /usr
123     Snapshots on /usr       PFS #3
124     Transaction ID          Timestamp               Note
125
126 The best way to take a snapshot of all PFSes is to run the command `hammer cleanup`. It does a lot of things but the fist thing it does during cleanup of a PFS is to take its snapshots as configured.
127
128     # sudo hammer cleanup
129     cleanup /                    - HAMMER UPGRADE: Creating snapshots
130             Creating snapshots in /var/hammer/root
131      handle PFS #0 using /var/hammer/root
132                snapshots - run
133                    prune - run
134                rebalance - run..
135                  reblock - run....
136                   recopy - run....
137     cleanup /var                 - HAMMER UPGRADE: Creating snapshots
138     [...]
139     cleanup /tmp                 - HAMMER UPGRADE: Creating snapshots
140     [...]
141     cleanup /usr                 - HAMMER UPGRADE: Creating snapshots
142     [...]
143     cleanup /home                - HAMMER UPGRADE: Creating snapshots
144     [...]
145     cleanup /usr/obj             - HAMMER UPGRADE: Creating snapshots
146     [...]
147     cleanup /var/crash           - HAMMER UPGRADE: Creating snapshots
148     [...]
149     cleanup /var/tmp             - HAMMER UPGRADE: Creating snapshots
150     [...]
151     cleanup /var/isos            - HAMMER UPGRADE: Creating snapshots
152     [...]
153
154 No snapshots were taken for `/tmp`, `/usr/obj` and `/var/tmp`. This is because the PFSes are flagged as `nohistory`. HAMMER tracks history for all files in a PFS, naturally this consumes disk space until the history is pruned. To prevent that temporary files on the mentioned PFSes (e.g., object files, crash dumps) consume disk space, the PFSes are marked as `nohistory`.
155
156 In `/var` will be a new directory called *hammer* with the following sub directories
157
158
159     # cd hammer/
160     # ls -l
161     total 0
162     drwxr-xr-x  1 root  wheel  0 Oct 13 11:51 home
163     drwxr-xr-x  1 root  wheel  0 Oct 13 11:42 root
164     drwxr-xr-x  1 root  wheel  0 Oct 13 11:43 tmp
165     drwxr-xr-x  1 root  wheel  0 Oct 13 11:51 usr
166     drwxr-xr-x  1 root  wheel  0 Oct 13 11:54 var
167
168
169 Well let us look inside `/var/hammer/usr`
170
171
172     # cd usr/
173     # ls -l
174     total 0
175     drwxr-xr-x  1 root  wheel   0 Oct 13 11:54 obj
176     lrwxr-xr-x  1 root  wheel  25 Oct 13 11:43 snap-20101013-1143 -> /usr/@@0x0000000117ac6cb0
177
178
179 We have a symlink pointing to the snapshot transaction ID shown below.
180
181
182     # hammer snapls /usr
183     Snapshots on /usr       PFS #3
184     Transaction ID          Timestamp               Note
185     0x0000000117ac6cb0      2010-10-13 11:43:04 IST -
186     #
187
188
189 You can read more about snapshots, prune, reblance, reblock, recopy etc from [hammer(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=hammer&section=8) especially look under the heading "cleanup [filesystem ...]"
190
191 You can learn more about PFS mirroring [here](http://www.dragonflybsd.org/docs/how_to_implement_hammer_pseudo_file_system__40___pfs___41___slave_mirroring_from_pfs_master/)
192
193 ## Configuring and Starting the SSH Server
194
195 Described in detail [[here|/docs/newhandbook/sshserver/]]
196
197 ## Software/Programs and Configuration Files Location 
198
199 DragonFly default installation contains the base software/programs from the DragonFly project itself and few other software from [pkgsrc](http://www.netbsd.org/docs/software/packages.html) which is the DragonFly official package management system. Ready to install binary software from pkgsrc is referred to as *packages*.
200
201 The base programs are located in the folders 
202
203     /bin    /sbin
204     /usr/bin   /usr/sbin
205
206 The configuration files for the base system can be found in `/etc`. There is also `/usr/local/etc` which is used by third-party programs. The software/programs from pkgsrc are located in `/usr/pkg/bin` and `/usr/pkg/sbin`. Their configuration files are found in `/usr/pkg/etc`.
207
208 ## Installing Third-party Software
209
210 Have a look at the [[pkgsrc howto|docs/howtos/HowToPkgsrc/]] for an in-depth description about dealing with third-party pkgsrc packages.
211
212 ### Using pkgin
213
214 For those who are new to the DragonFly way of doing things can also have the Debian's apt like way of installing, removing and updating packages. *pkgin* does things similar to *apt-get* or *aptitude* or *yum* for that matter.
215
216 First we need to configure *pkgin* to use a repository which contains the pkgsrc binary packages.  For this example we will use the main DragonFly server. **Note**: Be sure to use a local  [[mirror|mirrors/]] for better performance and to reduce load on the main servers.
217
218     # echo "http://mirror-master.dragonflybsd.org/packages/i386/DragonFly-2.7/stable/All/" > \   
219              /usr/pkg/etc/pkgin/repositories.conf
220
221
222 Now to update *pkgin* with the list of latest packages available from that repository.
223
224
225     # pkgin update
226     cleaning database from
227     http://mirror-master.dragonflybsd.org/packages/i386/DragonFly-2.7/stable/All/
228     entries...
229     downloading pkg_summary.bz2: 100%
230     processing remote summary
231     (http://mirror-master.dragonflybsd.org/packages/i386/DragonFly-2.7/stable/All/)...
232     updating database: 100%
233
234 Now to upgrade packages that are already installed in the system
235
236
237     # pkgin full-upgrade
238     6 packages to be upgraded: freetype2-2.3.12 gtar-info-1.22
239     openldap-client-2.4.21 png-1.4.2 python26-2.6.5 tiff-3.9.4
240     1 packages to be removed: asciidoc-8.6.1
241     6 packages to be installed: png-1.4.3 python26-2.6.5nb1 tiff-3.9.4nb1
242     freetype2-2.4.2 gtar-info-1.23 openldap-client-2.4.23 (15M to
243     download, 59M to install)
244     proceed ? [y/N] y
245     downloading packages...
246     downloading png-1.4.3.tgz: 100%
247     downloading python26-2.6.5nb1.tgz: 100%
248     downloading tiff-3.9.4nb1.tgz: 100%
249     downloading freetype2-2.4.2.tgz: 100%
250     downloading gtar-info-1.23.tgz: 100%
251     downloading openldap-client-2.4.23.tgz: 100%
252     .....
253
254 In order to search for a new package, for example *rdesktop*.
255
256
257     # pkgin search rdesktop
258     rdesktop-1.6.0 =     Open-source Remote Desktop Protocol client
259     tsclient-0.132nb25   GNOME2 Frontend for rdesktop
260     
261     =: package is installed and up-to-date
262     <: package is installed but newer version is available
263     >: installed package has a greater version than available package
264
265 To search for a package and install it you can do the following. If there are different versions of the package available in the repository it will show you the list and you need to specify one from them explicitly. At the end of the installation it will show you a message if you need any further configuration for the software to work in a particular way.
266
267     # pkgin search mysql-client
268     mysql-client-4.1.22nb4  MySQL 4, a free SQL database (client)
269     mysql-client-5.0.91  MySQL 5, a free SQL database (client)
270     mysql-client-5.1.49  MySQL 5, a free SQL database (client)
271     
272     =: package is installed and up-to-date
273     <: package is installed but newer version is available
274     >: installed package has a greater version than available package
275     
276     # pkgin install mysql-client
277     there's more than one version available for this package.
278     please re-run pkgin with a package name matching one of the following:
279     mysql-client-4.1.22nb4
280     mysql-client-5.0.91
281     mysql-client-5.1.49
282     nothing to do.
283     
284     # pkgin install mysql-client-5.1.49
285     calculating dependencies for mysql-client-5.1.49...
286     nothing to upgrade. 
287     1 packages to be installed: mysql-client-5.1.49 (7620K to download, 24M to install)
288     proceed ? [y/N] y
289     downloading packages...
290     downloading mysql-client-5.1.49.tgz: 100%
291     installing packages...
292     installing mysql-client-5.1.49...
293     [...]
294     processing local summary...
295     updating database: 100%
296     marking mysql-client-5.1.49 as non auto-removable
297
298 To remove a package
299
300     # pkgin remove mysql-client
301     1 packages to delete: mysql-client-5.1.49
302     proceed ? [y/N] y
303     removing mysql-client-5.1.49...
304     processing local summary...
305     updating database: 100%
306
307
308 *pkgin* is very similar to *apt-get, aptitude , yum, emerge, pacman* and friends in the Linux world.
309
310 All the *pkgin* commands can be seen [here](http://imil.net/pkgin/). *pkgin* comes installed with the default DragonFly install so you can skip the installation part on that page.
311
312 To install a desktop you can [read the following](http://www.dragonflybsd.org/docs/newhandbook/X/)
313 Other Docs can be found [here](http://www.dragonflybsd.org/docs/newhandbook/X/).
314
315 ## Installing flash player on firefox.
316
317 The Flash plugin is distributed by Adobe in *binary form only*. Adobe does not provide a native DragonFlyBSD plugin, but there is a Linux plugin which you can use under Linux emulation. Linux emulation software is installed from *pkgsrc* and is tested to be working fine on x86 Platform. The steps are
318
319
320 ### Install *multimedia/libflashsupport* from *pkgsrc*. 
321
322     # cd /usr/pkgsrc/multimedia/libflashsupport
323     # bmake package
324
325 This will get you all packages needed for Linux Emulation. Currently the Linux Emulation package installs software from [Suse 10]( http://ftp.hosteurope.de/mirror/ftp.opensuse.org/discontinued/10.0/suse/i586/) distribution. You could see the list of packages installed using pkg_info.
326
327     # pkg_info |grep suse
328     suse_openssl-10.0nb5 Linux compatibility package for OpenSSL
329     suse_gtk2-10.0nb4   Linux compatibility package for GTK+-2.x
330     suse_gtk-10.0nb2    Linux compatibility package for GTK+-1.x
331     suse_libjpeg-10.0nb2 Linux compatibility package for JPEG
332     suse_base-10.0nb5   Linux compatibility package
333     suse_slang-10.0nb3  Linux compatibility package for S-Lang
334     suse_locale-10.0nb2 Linux compatibility package with locale files
335     suse_fontconfig-10.0nb6 Linux compatibility package for fontconfig
336     suse_libtiff-10.0nb4 Linux compatibility package for TIFF
337     suse_openmotif-10.0nb2 Linux compatibility package for OpenMotif
338     suse_libpng-10.0nb4 Linux compatibility package for PNG
339     suse_libcups-10.0nb4 Linux compatibility package for CUPS
340     suse_gdk-pixbuf-10.0nb3 Linux compatibility package for gdk-pixbuf
341     suse_expat-10.0nb2  Linux compatibility package for expat
342     suse_vmware-10.0nb2 Linux compatibility package to help run VMware
343     suse_libxml2-10.0nb2 Linux compatibility package for libxml2
344     suse_compat-10.0nb3 Linux compatibility package with old shared libraries
345     suse_x11-10.0nb4    Linux compatibility package for X11
346     suse_glx-10.0nb4    Linux compatibility package for OpenGL/Mesa
347     suse_freetype2-10.0nb5 Linux compatibility package for freetype-2.x
348     suse_aspell-10.0nb2 Linux compatibility package for aspell
349     suse-10.0nb4        SUSE-based Linux binary emulation environment
350
351 ### Configure Linux Support
352
353     # echo "linux_load=yes" >> /boot/loader.conf
354     # echo "linux_enable=yes" >> /etc/rc.conf
355     # echo "proc  /compat/linux/proc  linprocfs  rw  0  0" >> /etc/fstab
356
357 *Reboot DragonFly* ( not necessarry but easier for new users )  so that Linux Emulation is loaded to the kernel and configured correctly.
358
359 ### Install *www/nspluginwrapper* 
360
361 This willallow DragonFly to use the Linux Binary Flash Plugin
362
363     # cd /usr/pkgsrc/www/nspluginwrapper
364     # bmake package
365
366 ### Install multimedia/ns-flash
367
368 This is the Linux Flash Plugin itself.
369
370     # cd /usr/pkgsrc/multimedia/ns-flash
371     # bmake NO_CHECKSUM=yes package
372
373 You can check if the Flash plugin is installed right by.
374
375     # /usr/pkg/bin/nspluginwrapper --list
376     /usr/pkg/lib/netscape/plugins/npwrapper.libflashplayer.so
377       Original plugin: /usr/pkg/lib/netscape/plugins/libflashplayer.so
378       Wrapper version string: 1.2.2
379     /usr/pkg/lib/netscape/plugins/npwrapper.libflashplayer.so
380       Original plugin: /usr/pkg/lib/netscape/plugins/libflashplayer.so
381       Wrapper version string: 1.2.2
382
383 Don't worry if it is listed twice as above.
384
385 Now Start Firefox and type "*about:plugins*" in the address bar and you should find the flash plugins listed as [shown in this Picture](http://leaf.dragonflybsd.org/~sgeorge/PICs/flash-plugin-in-firefox.png).
386
387 You can watch Streaming Flash now.
388
389
390