Rust之旅 linux下rust环境搭建

Rust之旅 linux下rust环境搭建,第1张

从今天开始,我们将开始我们的Rust语言学习之路。Rust 语言是一种高效、可靠的通用高级语言。其高效不仅限于开发效率,它的执行效率也是令人称赞的,是一种少有的兼顾开发效率和执行效率的语言。

首先我们需要搭建好开发环境,本次选用linux作为服务器系统,也是为以后项目环境做考虑。毕竟windows作为服务器系统还是过于小众。

如果您曾经安装过 rustup,可以执行 rustup update 来升级 Rust。

在ssh界面运行以下命令:

如果您熟悉rustup安装程序并希望自定义安装,请选择第二个选项。 但是,出于本教程的考虑,我们仅选择默认的第一个选项,然后按Enter。

在 Rust 开发环境中,所有工具都安装在 ~/.cargo/bin 目录中,您可以在这里找到包括 rustc、cargo 和 rustup 在内的 Rust 工具链。

运行以下命令

运行以下命令

如果出现以下版本号则证明安装成功

如果想卸载 Rust,您可以运行

如果想更新Rust,可以运行

1. 更新到最新的软件包

Open up System ->Administration ->Update Manager

Click on Settings

Open the Updates Tab

Set 'Release upgrade' to 'Never'. That makes the option to upgrade to Karmic go away.

Close the settings dialog box.

Click on 'Check' to check for upgraded packages. It will look for packages that are upgraded from the version that is installed on your box.

Choose to install the upgrades. This will take a while on a freshly installed box.

2. 安装代码编辑工具

sudo apt-get install vim-gtk

3. 安装网络工具

TFTP服务器

1.安装TFTP服务器及客户端(tftp-hpa是客户端,tftpd-hpa是服务器端)

sudo apt-get install tftp-hpa tftpd-hpa

2.配制TFTP服务器,编辑/etc/default/tftpd-hpa,修改后的内容如下:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/tftpboot"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-l -c -s"

3.创建TFTP目录并重启TFTP服务

sudo mkdir /tftpboot

sudo chmod 777 /tftpboot

sudo service tftpd-hpa restart

4.测试

$tftp tftp服务器地址

>get 文件名(取文件)

>put 文件名(发送文件)

>quit (退出)

5.U-boot参数

set bootcmd tftpboot $loadkernaddr image_dir/zImage\bootm loadkernaddr

例子:set bootcmd tftpboot c0008000 192.168.1.10:kernel.img\bootm c0008000

NFS服务器

1. 安装NFS服务器

sudo apt-get install nfs-kernel-server

2. 配制/etc/exports

/rootfs *(rw,sync,no_root_squash)

3. 重启NFS服务

sudo /etc/init.d/portmap restart

sudo /etc/ini.d/nfs-kernel-server restart

4. 显示NFS共享目录

showmount –e

挂载和卸载NFS目录

sudo mount -t nfs NFS服务器地址:/rootfs /mnt

sudo umount /mnt

5. U-boot参数

setenv bootargs "root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off init=/init console=ttySAC2,115200"

例:

setenv bootargs "root=/dev/nfs rw nfsroot=192.168.1.10:/nfsboot/rootfs ip=192.168.1.199:192.168.1.10:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC1,115200"

SAMBA服务器

1:安装SAMBA服务器及客户端

sudo apt-get install samba

sudo apt-get install smbfs

sudo apt-get install system-config-samba

2:修改配制文件

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bck

sudo vim /etc/samba/smb.conf

只留下[global]

3:打开配制工具

sudo system-config-samba

配制samba用户和共享目录

4:重启SAMBA

sudo /etc/init.d/smbd restart

5:windows下 \\samba服务器地址

SSH

sudo apt-get install openssh-server openssh-client

修改主机名

sudo vim /etc/hostname


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8690215.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-19
下一篇 2023-04-19

发表评论

登录后才能评论

评论列表(0条)

保存