Posts

Showing posts from October, 2021

How To Install Nginx, MySQL and PHP (FEMP) Stack on FreeBSD 13.0

Image
1. First, update your FreeBSD system. # freebsd-update fetch # freebsd-update install   2. Install Nginx. # pkg install nginx Enable Nginx: # sysrc nginx_enable=yes   Start Nginx: # service nginx start Check if nginx is running normally? It worked. 3. Install MySQL # pkg install mysql80-client mysql80-server   Enable MySQL: # sysrc mysql_enable=yes   Start MySQL: # service mysql-server start  Starting mysql.   4. Install PHP The following command to install php8.0 and commonly used modules: # pkg install php74 php74-mysqli php74-mbstring php74-zlib php74-curl php74-gd php74-json 5. Configure Nginx and PHP to make them work together   Edit Nginx's config file  /usr/local/etc/nginx/nginx.conf  uncomment or modify or add config as follows: user  www; error_log  /var/log/nginx/error.log;   http block: access_log  /var/log/nginx/access.log;  location ~ \.php$ {     root           /usr/local/www/nginx;     fastcgi_pass   127.0.0.1:9000;     fastcgi_index  index.php;     fastcgi_param  S

How to install Linux(Ubuntu Server 20.04) VM on FreeBSD 13.0 using bhyve and ZFS

Image
1. Preparing the Host First, load the bhyve kernel module: # kldload vmm Then, create a tap interface for the network device in the virtual machine to attach to. In order to for the network device to participate in the network, also create a bridge interface containing the tap interface and the physical interface as members. In this example, the physical interface is em0: # ifconfig tap0 create # sysctl net.link.tap.up_on_open=1 net.link.tap.up_on_open: 0 -> 1 # ifconfig bridge0 create # ifconfig bridge0 addm em0 addm tap0 # ifconfig bridge0 up 2. Preparing for the Installation Download  Ubuntu Server 20.04.3 LTS In order to boot Linux systems, grub2-bhyve must be first installed as follows: # pkg install grub2-bhyve     3. Creating a Linux Guest A ZFS volume can be created by: # zfs create -V16G -o volmode=dev zroot/linuxdisk0 Create a device.map that grub will use to map the virtual device to the files on the host system: (hd0)  /dev/zvol/zroot/linuxdisk0 (cd0)  /path/to/ubun

How to install Windows10 VM on FreeBSD 13.0 using bhyve and ZFS.

1. Preparing the Host First, load the bhyve kernel module: # kldload vmm   Then, create a tap interface for the network device in the virtual machine to attach to. In order to for the network device to participate in the network, also create a bridge interface containing the tap interface and the physical interface as members. In this example, the physical interface is em0: # ifconfig tap0 create # sysctl net.link.tap.up_on_open=1 net.link.tap.up_on_open: 0 -> 1 # ifconfig bridge0 create # ifconfig bridge0 addm em0 addm tap0 # ifconfig bridge0 up 2. Using ZFS with bhyve Guests A ZFS volume can be created by: # zfs create -V88G -o volmode=dev zroot/win10disk0   If you want to destroy ZFS file. # zfs list   For example the ZFS file you want to destroy is  win10disk0: # zfs destroy  zroot/win10disk0 3. Preparing for the Installation Download an installation image of  Windows10 to install: https://www.microsoft.com/en-us/software-download/windows10ISO Install VNC client # pkg install ti

How to install FreeBSD VM on FreeBSD using bhyve and ZFS.

1. Preparing the Host  First, load the bhyve kernel module: # kldload vmm Then, create a tap interface for the network device in the virtual machine  to attach to. In order for the network device to participate in the network,  also create a bridge interface containing the tap interface and the physical  interface as members. In this example, the physical interface is em0: # ifconfig tap0 create # sysctl net.link.tap.up_on_open=1  net.link.tap.up_on_open: 0 -> 1 # ifconfig bridge0 create # ifconfig bridge0 addm em0 addm tap0 # ifconfig bridge0 up 2. Using ZFS with bhyve Guests If ZFS is available on the host machine, using ZFS volumes instead of disk  image file can provide significant performance benefits for the guest VMs.  A ZFS volume can be created by: # zfs create -V16G -o volmode=dev zroot/freebsddisk0 Download an installation image of FreeBSD to install:  https://download.freebsd.org/ftp/releases/ISO-IMAGES/13.0/ or   https://wiki.freebsd.org/Torrents to iso via qiBttorrent

FreeBSD安装xfce图形桌面

 1.安装依赖及xfce # pkg install -y xorg # pkg install -y xfce # pkg install -y slim 2.使能xfce # ee /etc/rc.conf 添加内容如下: moused_enable="YES" dbus_enable="YES" slim_enable="YES" 为了通过输入startx从命令行启动xfce, 需要往~/.xinitrc加入下面的命令: % echo ". /usr/local/etc/xdg/xfce4/xinitrc" > ~/.xinitrc 3.往slim.conf添加默认用户名 往slim.conf添加默认用户名好处是每当你要登录时就省去了输入用户名的时间. # ee /usr/local/etc/slim.conf 把下面这行的注释去掉并把username改为你的用户名 default_user  username 4.重启 # reboot

FreeBSD卸载用不到的依赖库或软件.

 FreeBSD卸载软件一般的命令是: # pkg delete software_name 或 # pkg delete -R software_name 后来发现上面的两个命令不能把安装软件A时连带一起安装的依赖库或者软件也给安装; 但是这些依赖库或者软件,在软件A卸载时,并没有一起被卸载掉. 那么怎么才能把这些没有用到的依赖库或者软件给卸载掉呢? 命令如下: # pkg autoremove