在幸狐RV1106板子上用gcc14.2本地编译安装samba-4.22.3服务器,并且支持XP系统访问共享文件夹
工作目录:
mkdir ~/software/samba
cd ~/software/samba
【编译安装nettle-3.10.2】
wget https://ftp.gnu.org/gnu/nettle/nettle-3.10.2.tar.gz --no-check-certificate
tar xf nettle-3.10.2.tar.gz
cd nettle-3.10.2
./configure --enable-mini-gmp
make
make install
ldconfig
cd ..
【编译安装gmp-6.3.0】
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz --no-check-certificate
tar xf gmp-6.3.0.tar.xz
cd gmp-6.3.0
./configure
make
make install
ldconfig
cd ..
【编译安装libtasn1-4.20.0】
wget https://ftp.gnu.org/pub/gnu/libtasn1/libtasn1-4.20.0.tar.gz --no-check-certificate
tar xf libtasn1-4.20.0.tar.gz
cd libtasn1-4.20.0
./configure
make
make install
ldconfig
cd ..
【编译安装libffi-3.5.1】
wget https://github.com/libffi/libffi/releases/download/v3.5.1/libffi-3.5.1.tar.gz --no-check-certificate
tar xf libffi-3.5.1.tar.gz
cd libffi-3.5.1
./configure
make
make install
ldconfig
cd ..
【编译安装p11-kit-0.25.5】
wget https://github.com/p11-glue/p11-kit/releases/download/0.25.5/p11-kit-0.25.5.tar.xz --no-check-certificate
tar xf p11-kit-0.25.5.tar.xz
cd p11-kit-0.25.5
./configure --without-trust-paths
swapon /root/swapfile
make
make install
swapoff /root/swapfile
ldconfig
cd ..
【编译安装texinfo-7.2】
(里面有makeinfo命令)
wget https://ftp.gnu.org/pub/gnu/texinfo/texinfo-7.2.tar.gz --no-check-certificate
tar xf texinfo-7.2.tar.gz
cd texinfo-7.2
./configure
make
make install
ldconfig
cd ..
【编译安装gnutls-3.8.10】
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.10.tar.xz --no-check-certificate
tar xf gnutls-3.8.10.tar.xz
cd gnutls-3.8.10
./configure --with-included-unistring
swapon /root/swapfile
make
make install
swapoff /root/swapfile
ldconfig
cd ..
【编译安装libgpg-error-1.55】
wget https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.55.tar.gz --no-check-certificate
tar xf libgpg-error-1.55.tar.gz
cd libgpg-error-1.55
./configure
make
make install
ldconfig
cd ..
【编译安装libassuan-3.0.2】
wget https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-3.0.2.tar.bz2 --no-check-certificate
tar xf libassuan-3.0.2.tar.bz2
cd libassuan-3.0.2
./configure
make
make install
ldconfig
cd ..
【编译安装libgcrypt-1.11.1】
wget https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.11.1.tar.bz2 --no-check-certificate
tar xf libgcrypt-1.11.1.tar.bz2
cd libgcrypt-1.11.1
./configure
make
make install
ldconfig
cd ..
【编译安装libksba-1.6.7】
wget https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.6.7.tar.bz2 --no-check-certificate
tar xf libksba-1.6.7.tar.bz2
cd libksba-1.6.7
./configure
make
make install
ldconfig
cd ..
【编译安装npth-1.8】
wget https://www.gnupg.org/ftp/gcrypt/npth/npth-1.8.tar.bz2 --no-check-certificate
tar xf npth-1.8.tar.bz2
cd npth-1.8
./configure
make
make install
ldconfig
cd ..
【编译安装gnupg-2.4.8】
wget https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.4.8.tar.bz2 --no-check-certificate
tar xf gnupg-2.4.8.tar.bz2
cd gnupg-2.4.8
./configure
make
make install
ldconfig
cd ..
【编译安装gpgme-2.0.0】
wget https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-2.0.0.tar.bz2 --no-check-certificate
tar xf gpgme-2.0.0.tar.bz2
cd gpgme-2.0.0
./configure
make
make install
ldconfig
cd ..
【下载和安装Parse-Yapp-1.21】
(samba服务器要用到里面的Parse::Yapp::Driver)
wget https://cpan.metacpan.org/authors/id/W/WB/WBRASWELL/Parse-Yapp-1.21.tar.gz --no-check-certificate
tar xf Parse-Yapp-1.21.tar.gz
cd Parse-Yapp-1.21
perl Makefile.PL
make
make install
cd ..
提示:在板子上编译安装perl命令(perl-5.40.2软件包)的方法见https://blog.csdn.net/ZLK1214/article/details/149077086。
【编译安装jansson-2.14.1】
wget https://github.com/akheron/jansson/releases/download/v2.14.1/jansson-2.14.1.tar.gz --no-check-certificate
tar xf jansson-2.14.1.tar.gz
cd jansson-2.14.1
./configure
make
make install
ldconfig
cd ..
【编译安装libarchive-3.8.1】
wget https://libarchive.org/downloads/libarchive-3.8.1.tar.gz --no-check-certificate
tar xf libarchive-3.8.1.tar.gz
cd libarchive-3.8.1
./configure
make
make install
ldconfig
cd ..
【编译安装attr-2.5.2】
wget http://mirror.accum.se/mirror/gnu.org/savannah/attr/attr-2.5.2.tar.gz --no-check-certificate
tar xf attr-2.5.2.tar.gz
cd attr-2.5.2
./configure
make
make install
ldconfig
cd ..
【编译安装acl-2.3.2】
wget http://mirror.accum.se/mirror/gnu.org/savannah/acl/acl-2.3.2.tar.gz --no-check-certificate
tar xf acl-2.3.2.tar.gz
cd acl-2.3.2
./configure
make
make install
ldconfig
cd ..
【编译安装Linux-PAM-1.6.1】
(这是最后一版不需要meson的版本)
wget https://github.com/linux-pam/linux-pam/releases/download/v1.6.1/Linux-PAM-1.6.1.tar.xz --no-check-certificate
tar xf Linux-PAM-1.6.1.tar.xz
cd Linux-PAM-1.6.1
./configure
make
make install
ldconfig
cd ..
【编译安装autoconf-archive-2024.10.16】
(编译dbus-1.15.8才需要这个,如果选择编译dbus-1.15.6版本就不需要这个)
wget https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archive-2024.10.16.tar.xz --no-check-certificate
tar xf autoconf-archive-2024.10.16.tar.xz
cd autoconf-archive-2024.10.16
./configure
make
make install
cd ..
【编译安装dbus-1.15.8】
(这是最后一版不需要meson的版本,但是需要autoconf和autoconf-archive。如果没装autoconf的话可以选择1.15.6版本)
wget https://dbus.freedesktop.org/releases/dbus/dbus-1.15.8.tar.xz --no-check-certificate
tar xf dbus-1.15.8.tar.xz
cd dbus-1.15.8
autoreconf --install
./configure
make
make install
ldconfig
cd ..
【安装python3-markdown】
(关于python3的安装方法见https://blog.csdn.net/ZLK1214/article/details/149077324)
pip3 install markdown
【安装python3-dnspython】
pip3 install dnspython
【编译安装popt-1.19】
这是为了解决samba编译过程中,编译source4/torture/krb5/kdc-heimdal.c文件时找不到popt.h的问题(https://bugzilla.samba.org/show_bug.cgi?id=14751)。
wget https://ftp.osuosl.org/pub/rpm/popt/releases/popt-1.x/popt-1.19.tar.gz --no-check-certificate
tar xf popt-1.19.tar.gz
cd popt-1.19
./configure
make
make install
ldconfig
cd ..
未安装popt库时编译samba的报错信息:
[root@luckfox-rv1106 ~/software/samba/samba-4.22.3]# make
PYTHONHASHSEED=1 WAF_MAKE=1 ./buildtools/bin/waf build
Waf: Entering directory `/root/software/samba/samba-4.22.3/bin/default'
Selected embedded Heimdal build
[3793/4455] Compiling source4/torture/krb5/kdc-heimdal.c
In file included from ../../source4/torture/krb5/kdc-heimdal.c:29:
../../lib/cmdline/cmdline.h:22:10: fatal error: popt.h: No such file or directory
22 | #include <popt.h>
| ^~~~~~~~
compilation terminated.
Waf: Leaving directory `/root/software/samba/samba-4.22.3/bin/default'
Build failed
-> task in 'TORTURE_KRB5' failed with exit status 1 (run with -v to display more information)
make: *** [Makefile:7: all] Error 1
[root@luckfox-rv1106 ~/software/samba/samba-4.22.3]#
【编译安装samba-4.22.3】
编译samba需要libncurses.so库。关于不带w后缀的libncurses.so库的编译方法,请参考https://blog.csdn.net/ZLK1214/article/details/149076762。
wget https://download.samba.org/pub/samba/stable/samba-4.22.3.tar.gz --no-check-certificate
tar xf samba-4.22.3.tar.gz
cd samba-4.22.3
./configure
swapon /root/swapfile
make
make install
swapoff /root/swapfile
ldconfig
cd ..
【配置samba服务器】
复制配置文件:cp samba-4.22.3/examples/smb.conf.default /usr/local/samba/etc/smb.conf
修改/usr/local/samba/etc/smb.conf配置文件:
[global]里面,将workgroup的值设为WORKGROUP
然后添加下面三行,使Windows XP系统能正常访问文件共享:
server min protocol = NT1
lanman auth = yes
ntlm auth = yes
测试smb.conf的配置是否正确:/usr/local/samba/bin/testparm
添加nobody用户和组:(-S表示创建的是系统用户,也就是编号从100开始)
addgroup -S nobody
adduser -G nobody -SDH nobody
在samba中添加文件共享专用root用户并输入密码,密码可以和系统里面的root用户密码不一样:
/usr/local/samba/bin/smbpasswd -a root
启动samba服务器:
/usr/local/samba/sbin/nmbd -D
/usr/local/samba/sbin/smbd -D
查看samba是否启动成功:ps | grep samba
有nmbd和smbd说明启动成功了。
其中nmbd负责提供计算机名,smbd负责提供文件共享服务。
若启动失败,
查看nmbd启动失败的原因:cat /usr/local/samba/var/log.nmbd
查看smbd启动失败的原因:cat /usr/local/samba/var/log.smbd
在Windows XP系统中通过计算机名(板子的hostname)访问文件共享:
用户是root,密码是刚才用smbpasswd命令设置的密码,不是linux系统里面的root用户的密码。
登录的是什么用户,里面就出来什么用户的home目录。root用户的home目录就叫root。
进入root目录:
查看工作组,里面可以看到Luckfox-rv1106这台电脑:
可以在命令行中ping通板子的计算机名(hostname):
板子上如果安装了apache服务器的话,可以通过计算机名访问板子里面的https网站:
(注意XP系统的IE6不支持在网址中直接使用IPv6地址访问网站,但IE7和8是可以的)