You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.1 KiB

<style type="text/css">
pre {
margin-left: 2em;
}
</style>
<!-- NetBSD logo, right-aligned. Non-commercial use is permitted. -->
<div style="float:right;margin-right:1em;">
<img src="http://sdf.org/tutorials/images/NetBSD.png"/>
</div>
<h1>NetBSD on SDF VPS</h1>
<h2>Contents</h2>
<ul>
<li><a href="#basics">Basics</a></li>
<li><a href="#networking">Networking</a></li>
<li><a href="#pkgsrc">pkgsrc</a></li>
<li><a href="#references">References</a></li>
</ul>
<h2 id="basics">Basics</h2>
<p>Upon logging in to your VPS for the first time, one of the first
things you will want to do is change the default root password
by typing <code>passwd</code> at the prompt. Don't forget this
password as there is currently no way to recover it.</p>
<p>It is customary on UNIX systems for the system clock to be set
to UTC. To set the local time zone, find your zone file in
<code>/usr/share/zoneinfo/</code> and link to it at
<code>/etc/localtime</code> as follows:</p>
<pre>ln -fs /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
</pre>
<p>It is also a good habit to create a regular user account for
working, using <code>su</code> to obtain root privileges as needed.
To create a regular user account which is part of the administrative
<code>wheel</code> group:</p>
<pre>adduser -m -G wheel &lt;username&gt;
</pre>
<p>This user will be in the <code>wheel</code> group and will be able
to perform administrative tasks by runing <code>su</code> to obtain
superuser privileges using the root password.</p>
<h2 id="networking">Networking</h2>
<p>In your control panel at vps.sdf.org, note YOUR_IP
(e.g. 192.94.73.255) on the top line, and YOUR_HOSTNAME
(e.g. netbsd99).</p>
<p>Start your server, and log in via the console. (default= root:root)</p>
<p>Open /etc/rc.conf in an editor and, replacing the text YOUR_HOSTNAME and YOUR_IP with
your own actual host name and IP number, add:</p>
<pre>hostname=YOUR_HOSTNAME.sdf.org
defaultroute=192.94.73.1
auto_ifconfig=yes
ifconfig_xennet0="inet YOUR_IP netmask 0xffffff00"
</pre>
<p>Then put this in /etc/resolv.conf:</p>
<pre>nameserver 192.94.73.120
</pre>
<p>Add this to /etc/hosts:</p>
<pre>YOUR_IP YOUR_HOSTNAME.sdf.org YOUR_HOSTNAME
</pre>
<!-- <p>Run/Type:</p>
<pre>hostname -s YOUR_HOSTNAME.sdf.org
</pre>
-->
<p>Run/Type:</p>
<pre>/etc/rc.d/network restart.
</pre>
<h2 id="pkgsrc">pkgsrc</h2>
<p>On NetBSD you can now mount a pre-build (and still in progress)
pkgsrc DESTDIR.
Following the procedures below will effectively install the 2000+ included
packages on your virtual NetBSD system.</p>
<p>Note that at the moment the pre-built pkgsrc assumes that its path is
/images/pkg_neb501 - otherwise some programs won't work (will not be
able to use their shared libraries). The instructions below will show
how to make this work.</p>
<p>Simply:</p>
<pre>mkdir -p /images/pkg_neb501
rmdir /usr/pkg
ln -s /images/pkg_neb501 /usr/pkg
rm -rf /var/db/pkg
ln -s /images/pkg_neb501/db/pkg /var/db/pkg
mount -t nfs 192.94.73.120:/images/pkg_neb501 /images/pkg_neb501
export PATH=$PATH:/usr/pkg/bin:/usr/pkg/sbin
</pre>
<p>It is read only.</p>
<p>To set this up on boot:</p>
<table>
<tr><td>
<pre>mkdir -p /images/pkg_neb501
rmdir /usr/pkg
ln -s /images/pkg_neb501 /usr/pkg
rm -rf /var/db/pkg
ln -s /images/pkg_neb501/db/pkg /var/db/pkg
</pre>
</td>
<td style="border-left: 1px dotted black;">(These commands are only necessary if you <em>didn't</em> execute the procedure above.)</td>
</tr>
<tr>
<td colspan=2>
<pre>
echo "nfs_client=YES" >> /etc/rc.conf
echo "rpcbind=YES" >> /etc/rc.conf
echo "192.94.73.120 vps" >> /etc/hosts
echo "vps:/images/pkg_neb501 /images/pkg_neb501 nfs ro" >> /etc/fstab
echo "export PATH=$PATH:/usr/pkg/bin:/usr/pkg/sbin" >> /etc/profile
</pre>
<p>Note that you cannot use both this pre-build pkgsrc and pre-built
packages from netbsd.org - it may be possible to set the system up
so you can, however this is best left to the experienced NetBSD
administrator.</p>
<h2 id="references">References</h2>
<ul>
<li><a href="http://www.netbsd.org/docs/guide/en/">The NetBSD Guide</a></li>
</ul>
<hr />
<div>
$Id: VPS_NetBSD.html.bak,v 1.1 2019/12/06 20:50:52 thegiant Exp $
</div>