No, you do not use the normal amd64 image that you would install on a standalone PC. You use the special pre-prepared public image through Google's cloud management tools, as described in the section of the release announcement that I quoted above. Here it is again:
Code:
% gcloud compute instances create INSTANCE \
--image freebsd-10-3-release-amd64 \
--image-project=freebsd-org-cloud-dev
% gcloud compute ssh INSTANCE
See also:
Although Google's docs do not currently list FreeBSD, their docs for Linux should mostly be appropriate for things outside the running instance (you just need to use the FreeBSD images instead of Linux images, and then do things the normal FreeBSD way inside the running instance).
Well I prefer to make a special image.
But I have just one problem...
After complete install of FreeBSD I don't know which password to use.
I used this script to make the custom image:
Code:
VERSION=10.3-RELEASE
VMSIZE=10g
SWAPSIZE=1G
NEWFS_OPTIONS="-U -j -t"
COMPONENTS="base kernel"
TS=`env TZ=UTC date +%Y%m%d%H%M%S`
IMAGENAME=`echo FreeBSD-${VERSION}-amd64-${TS} | tr '[A-Z]' '[a-z]' | sed -e 's/\.//g'`
BUCKETFILE=FreeBSD-${VERSION}-amd64-${TS}.tar.gz
TMPFILE=FreeBSD-${VERSION}-amd64-gcloud-image-${TS}.raw
WRKDIR=${PWD}
TMPMOUNT=/mnt/gcloud_new_${TS}
###############################
cleanup() {
set +e
echo "Error or interrupt detected, cleaning up and exiting"
cd ${WRKDIR}
umount -f ${TMPMOUNT} >/dev/null 2>&1
rmdir ${TMPMOUNT} >/dev/null 2>&1
mdconfig -d -u ${MD_UNIT} >/dev/null 2>&1
rm -f ${TMPFILE} disk.raw pmbr gptboot /tmp/mkimg-?????? >/dev/null 2>&1
trap - SIGHUP SIGINT SIGTERM EXIT
echo
exit 1
}
build_mirror() {
cd ${WRKDIR}
mkdir -p ${VERSION}
cd ${VERSION}
for comp in ${COMPONENTS} ; do
if [ ! -f ${comp}.txz ]; then
fetch http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/${VERSION}/${comp}.txz
fi
done
}
build_image() {
cd ${WRKDIR}
truncate -s ${VMSIZE} ${TMPFILE}
MD_UNIT=$(mdconfig -f ${TMPFILE})
echo " Creating filesystem"
newfs ${NEWFS_OPTIONS} ${MD_UNIT} >/dev/null 2>&1
mkdir -p ${TMPMOUNT}
mount /dev/${MD_UNIT} ${TMPMOUNT}
cd ${TMPMOUNT}
for comp in ${COMPONENTS} ; do
echo " Installing ${comp} into image"
tar -xzf ${WRKDIR}/${VERSION}/${comp}.txz
done
}
setup_image() {
cd ${TMPMOUNT}
cat << EOF > etc/resolv.conf
search google.internal
nameserver 8.8.4.4
nameserver 8.8.8.8
EOF
cat << EOF > etc/fstab
# Custom /etc/fstab for FreeBSD VM images
/dev/gpt/rootfs / ufs rw 1 1
/dev/gpt/swapfs none swap sw 0 0
EOF
cat << EOF > etc/rc.conf
hostname="Ira"
ifconfig_vtnet0="SYNCDHCP mtu 1460"
ntpd_sync_on_start="YES"
sshd_enable="YES"
EOF
cat << EOF > boot/loader.conf
autoboot_delay="-1"
beastie_disable="YES"
loader_logo="none"
hw.memtest.tests="0"
console="comconsole"
hw.vtnet.mq_disable=1
kern.timecounter.hardware=ACPI-safe
aesni_load="YES"
nvme_load="YES"
EOF
cat << EOF >> etc/hosts
169.254.169.254 metadata.google.internal metadata
EOF
cat << EOF > etc/ntp.conf
server metadata.google.internal iburst
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 127.127.1.0
EOF
cat << EOF >> etc/syslog.conf
*.err;kern.warning;auth.notice;mail.crit /dev/console
EOF
cat << EOF >> etc/ssh/sshd_config
ChallengeResponseAuthentication no
X11Forwarding no
AcceptEnv LANG
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
AllowAgentForwarding no
PermitRootLogin yes
PasswordAuthentication yes
ChallengeResponseAuthentication yes
ClientAliveInterval 420
EOF
cat << EOF >> etc/crontab
0 3 * * * root /usr/sbin/freebsd-update cron
EOF
cat << EOF >> etc/sysctl.conf
net.inet.icmp.drop_redirect=1
net.inet.ip.redirect=0
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
kern.ipc.somaxconn=1024
debug.trace_on_panic=1
debug.debugger_on_panic=0
EOF
sed -E -i '' 's/^([^#].*[[:space:]])on/\1off/' etc/ttys
touch ./firstboot
}
finish_image() {
cd ${TMPMOUNT}
cp boot/pmbr ${WRKDIR}
cp boot/gptboot ${WRKDIR}
cd ${WRKDIR}
umount ${TMPMOUNT}
rmdir ${TMPMOUNT}
mdconfig -d -u ${MD_UNIT}
echo " Creating partitioned file"
mkimg -s gpt -b pmbr \
-p freebsd-boot/bootfs:=gptboot \
-p freebsd-swap/swapfs::${SWAPSIZE} \
-p freebsd-ufs/rootfs:=${TMPFILE} \
-o disk.raw
rm ${TMPFILE} pmbr gptboot
echo " Creating image tar"
tar --format=gnutar -Szcf ${BUCKETFILE} disk.raw
rm disk.raw
}
###############################
if [ $(id -u) != 0 ]; then
echo "This script must be run as root" 1>&2
exit 1[CODE] echo root | pw mod user root -h 0
fi
set -e
trap cleanup SIGHUP SIGINT SIGTERM EXIT
cd ${WRKDIR}
echo "Building mirror of OS components"
build_mirror
echo "Creating image"
build_image
echo "Setting up image"
setup_image
echo "Finishing image"
finish_image
trap - SIGHUP SIGINT SIGTERM EXIT[/CODE]
My question is, what password will be assigned to user root after installing?
How I can do to set a password after installation is done?
My idea was to add this maybe I added it wrong? If someone has an idea please reply.
Code:
echo root | pw mod user root -h 0
But it does not work, still says wrong password.
PS: I don't want the google cloud packages, I want a clean very clean fresh installed system.