freebsd 8.1-基本配置(网络、port、package、x11、gnome)



 本文由深未来原创:http://deepfuture.iteye.com/,转载,请注明出处。

1、配置登录用户可以具有SU的权限,就是可以转到root用户。

直接修改/etc/group文件,把相应的用户加到wheel组就可以
      wheel:*:0:root,username

本文由深未来原创:http://deepfuture.iteye.com/,转载,请注明出处。


2、配置网卡

1)查看网卡

ifconfig

rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 00:0a:eb:69:5d:a1
        inet 192.168.1.168 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
rl1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 00:0a:eb:5c:25:87
        media: Ethernet autoselect
        status: no carrier
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>

本机有2块网卡,我只使用其中一块:rl0

 

本文由深未来原创:http://deepfuture.iteye.com/,转载,请注明出处。

2)

A)配置IP和网关

/etc/rc.conf

ee /etc/rc.conf

 

# -- sysinstall generated deltas -- # Tue Jan  1 08:21:16 2002
# Created: Tue Jan  1 08:21:16 2002
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
inetd_enable="YES"
sshd_enable="YES"
ifconfig_rl0="inet 192.168.1.168 netmask  255.255.255.0" 
defaultrouter="192.168.1.1"

 

其中ifconfig_rl0为配置网卡1,网关为192.168.1.1

 

B)配置dns

ee /etc/resolv.conf

 

=====line 2 col 24 lines from top 2 ===========================================
nameserver 58.20.127.170
nameserver 58.20.127.238

 

C)重新启动,生效:

reboot

 

D)测试是否成功

# ping www.163.com
PING 163.xdwscache.glb0.lxdns.com (58.248.245.40): 56 data bytes
64 bytes from 58.248.245.40: icmp_seq=0 ttl=55 time=38.687 ms
64 bytes from 58.248.245.40: icmp_seq=1 ttl=55 time=40.063 ms
64 bytes from 58.248.245.40: icmp_seq=2 ttl=55 time=118.553 ms
64 bytes from 58.248.245.40: icmp_seq=3 ttl=55 time=40.267 ms
64 bytes from 58.248.245.40: icmp_seq=5 ttl=55 time=39.294 ms

 

 

3、port ,是指从源代码安装,但是这个源代码是经过整理的,在port的管理下,而且可以通过port来自动升级和管理。

1)ports collection

A)如果ports collection没有安装则:

可以通过使用sysinstall命令安装ports collection,在不联网的情况下。

 

在联网的情况下,可以如下操作

先删除/usr/ports目录下的所有文件

# cd /usr/ports
# ls
.cvsignore      README          benchmarks      dns             hungarian       multimedia      print           x11
CHANGES         Templates       biology         editors         irc             net             russian         x11-clocks
COPYRIGHT       Tools           cad             emulators       japanese        net-im          science         x11-drivers
GIDs            UIDs            chinese         finance         java            net-mgmt        security        x11-fm
INDEX-8         UPDATING        comms           french          korean          net-p2p         shells          x11-fonts
KNOBS           accessibility   converters      ftp             lang            news            sysutils        x11-servers
LEGAL           arabic          databases       games           mail            palm            textproc        x11-themes
MOVED           archivers       deskutils       german          math            polish          ukrainian       x11-toolkits
Makefile        astro           devel           graphics        mbone           ports-mgmt      vietnamese      x11-wm
Mk              audio           distfiles       hebrew          misc            portuguese      www

 # rm -rf /usr/ports/*

 

#cp /usr/share/examples/cvsup/ports-supfile /root/ports-supfile

#ee /root/ports-supfile

 

 

# prefix=/usr
#               This specifies where to place the requested files.  A
#               setting of "/usr" will place all of the files requested
#               in "/usr/ports" (e.g., "/usr/ports/devel", "/usr/ports/lang").
#               The prefix directory must exist in order to run CVSup.

# Defaults that apply to all the collections
#
# IMPORTANT: Change the next line to use one of the CVSup mirror sites
# listed at http://www.freebsd.org/doc/handbook/mirrors.html .
*default host=cvsup.FreeBSD.org     
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.

然后开始安装ports collection

# csup -L 2 /root/ports-supfile
Parsing supfile "/root/supfile"
Connecting to cvsup.FreeBSD.org
Connected to 72.233.193.64
Server software version: SNAP_16_1h
Negotiating file attribute support
Exchanging collection information

 

查看ports collection

 # cd /usr/ports
# ls
.cvsignore      KNOBS           Mk              UIDs            archivers       biology         converters
CHANGES         LEGAL           README          UPDATING        astro           cad             databases
COPYRIGHT       MOVED           Templates       accessibility   audio           chinese         deskutils
GIDs            Makefile        Tools           arabic          benchmarks      comms           devel

B)如果ports collection已经安装,则安装portsnap,portsnap可以更快地管理ports

安装protsnap

#pkg_add -r portsnap

获得数据

#portsnap fetch

如果你是第一次使用portsnap,则展开它

#portsnap extract

更新ports

#portsnap update

 

 

2)安装 ports

以安装 sqlite为例

# cd databases/sqlite34

# make

 

 

===>  Vulnerability check disabled, database not found
===>  License check disabled, port has not defined LICENSE
===>  Found saved configuration for sqlite34-3.4.2
=> sqlite-3.4.2.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/local-distfiles/mnag/sqlite34/ .
sqlite-3.4.2.tar.gz                           100% of 2321 kB   60 kBps 00m00s
===>  Extracting for sqlite34-3.4.2
=> SHA256 Checksum OK for sqlite-3.4.2.tar.gz.
===>  Patching for sqlite34-3.4.2
===>   Converting DOS text file to UNIX text file:
===>  Applying FreeBSD patches for sqlite34-3.4.2
===>   sqlite34-3.4.2 depends on executable: tclsh8.5 - not found
===>    Verifying install for tclsh8.5 in /usr/ports/lang/tcl85
     => No directory for tclsh8.5.  Skipping..
===>   sqlite34-3.4.2 depends on executable: gmake - not found
===>    Verifying install for gmake in /usr/ports/devel/gmake
===>  Vulnerability check disabled, database not found
===>  License check disabled, port has not defined LICENSE
=> make-3.81.tar.bz2 doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://ftp.gnu.org/gnu/make/ .

#make install

#make clean

===>  Cleaning for tcl-8.5.9
===>  Cleaning for gmake-3.81_4
===>  Cleaning for libtool-2.2.10
===>  Cleaning for pkg-config-0.25_1
===>  Cleaning for tcl-modules-8.5.9
===>  Cleaning for gettext-0.18.1.1
===>  Cleaning for libiconv-1.13.1_1
===>  Cleaning for sqlite34-3.4.2

2)查看哪些ports需要升级

# pkg_version -v
en-freebsd-doc-20100625             <   needs updating (port has 20110110)
gettext-0.18.1.1                    =   up-to-date with port
gmake-3.81_4                        =   up-to-date with port
libiconv-1.13.1_1                   =   up-to-date with port
libtool-2.2.10                      =   up-to-date with port
pkg-config-0.25_1                   =   up-to-date with port
sqlite34-3.4.2                      =   up-to-date with port
tcl-8.5.9                           =   up-to-date with port
tcl-modules-8.5.9                   =   up-to-date with port
zh_cn-freebsd-doc-20100625          <   needs updating (port has 20110110)

 

 本文由深未来原创:http://deepfuture.iteye.com/,转载,请注明出处。

4、package

1)列出所有安装的软件包

# pkg_info
en-freebsd-doc-20100625 Documentation from the FreeBSD Documentation Project
gettext-0.18.1.1    GNU gettext package
gmake-3.81_4        GNU version of 'make' utility
libiconv-1.13.1_1   A character set conversion library
libtool-2.2.10      Generic shared library support script
pkg-config-0.25_1   A utility to retrieve information about installed libraries
sqlite34-3.4.2      An SQL database engine in a C library
tcl-8.5.9           Tool Command Language
tcl-modules-8.5.9   Tcl common modules
zh_cn-freebsd-doc-20100625 Simplified Chinese translation of the FreeBSD Documentation
2)下载并安装软件,以portupdate为例

# pkg_add -r portupgrade
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/Latest/portupgrade.tbz ... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.1-release/All/ruby-1.8.7.248_2,1.tbz ...
3)portupgrade 可用于升级现有软件包

portupgrade -ai 升级所有包

portupgrade  包名

查看某个软件包的信息

# whereis portupgrade
portupgrade: /usr/local/sbin/portupgrade /usr/local/man/man1/portupgrade.1.gz /usr/ports/ports-mgmt/portupgrade

修正

#pkgdb -f

升级

# /usr/local/sbin/portupgrade -ai
--->  Session started at: Tue, 18 Jan 2011 20:27:55 +0800
/usr/ports/INDEX-8.bz2                        100% of 1447 kB   47 kBps 00m00s

5、x11

#cd /usr/ports/x11/xorg

#make install clean

 

 本文由深未来原创:http://deepfuture.iteye.com/ ,转载,请注明出处。

 

然后编辑/etc/rc.conf

hald_enable=yes
dbus_enable=yes 

重新启动电脑

#reboot

查看startx目录

# whereis startx
startx: /usr/local/bin/startx /usr/local/man/man1/startx.1.gz

首先启动一下能否运行

#/usr/local/bin/startx

然后按alt+shift+Fn,通常是alt+shift+F2,进入虚拟控制台后,重新启动电脑

#reboot
建立配置文件

# Xorg -configure

X.Org X Server 1.7.5
Release Date: 2010-02-16
X Protocol Version 11, Revision 0
Build Operating System: FreeBSD 8.1-RELEASE i386
Current Operating System: FreeBSD  8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386

会在/root中生成一个叫做xorg.conf.new的配置文件
测试配置是否成功

#Xorg -config /root/xorg.conf.new -retro

进入虚拟控制台,然后重启电脑

再配置屏幕

#ee /root/xorg.conf.new

刷新率配置

Section "Monitor"
        #DisplaySize      300   230     # mm
        Identifier   "Monitor0"
        VendorName   "SAM"
        ModelName    "SyncMaster"
        HorizSync    30.0 - 61.0
        VertRefresh  56.0 - 75.0
        Option      "DPMS"
EndSection
分辨率和色深配置screen节,DefaultDepth指定默认色深

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth 24

        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes "1024x768"
        EndSubSection

特殊显示环境配置

首先需要知道驱动程序对应的ModeLines

ee /var/log/Xorg.0.log 找到足够的信息

ModeLine格式如下:

ModeLine 分辨率 时钟 <4 horiz.timings> <4 vert.timings> 

比如:

Modeline "1024x768"   65.00  1024 1048 1184 1344  768 771 777 806

然后设置/root/xorg.conf.new

Modeline "1024x768"   65.00  1024 1048 1184 1344  768 771 777 806

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "SAM"
        ModelName    "MybestModel"

        Modeline "1024x768"   65.00  1024 1048 1184 1344  768 771 777 806
        HorizSync    30.0 - 61.0
        VertRefresh  56.0 - 75.0
        Option      "DPMS"
EndSection

然后再测试,

#Xorg -config /root/xorg.conf.new -retro

成功后就可以将配置文件保存了

# cp /root/xorg.conf.new /etc/X11/xorg.conf

启动xorg

#startx


按alt+ctrl+Fn来切换到用于启动X的虚拟控制台

退出x环境

6、gnome

1)安装gnome2 

为防止安装过程出错,可以先更新ports

#portupgrade -a

再安装,可以使用2种方法安装

A)ports

#cd /usr/ports/x11/gnome2

#make install clean

B)package

#pkg_add -r gnome2

2)配置

如果事先已经使用了一些旧式的显示管理器,则必须取代这些管理器:

echo "#!/bin/sh" >~/.xinitrc

echo "/usr/local/bin/gnome-session">> ~/.xinitrc

chmod +x ~/.xsession

如果没有,则:

echo "/usr/local/bin/gnome-session"> ~/.xinitrc

然后reboot

最后启动

startx

 

中文环境配置

#cd ~         \\切换到用户根目录
#ee .cshrc  

加入下面的内容:
setenv LANG zh_CN.eucCN              (或  export  LANG='zh_CN.eucCN' )
setenv LC_LANG zh_CN.eucCN           (或  export  LC_LANG='zh_CN.eucCN' )
保存、退出、重启电脑,登陆后运行startx,进入Gnome,此时界面已经是中文版。

3)如果你想使用gdm,则需要安装

首先保证startx能正常启动GNOME,然后

A)安装

先卸载

#pkg_delete gdm或

#cd /usr/ports/x11/gdm

#make deinstall

然后安装

#cd /usr/ports/x11/gdm

#make install clean

B)激活gdm

#cp /usr/X11R6/etc/rc.d/gdm  /usr/local/etc/rc.d/gdm.sh

C)gdm配置为自动启动

# ee /etc/rc.conf

 

# -- sysinstall generated deltas -- # Fri Jan 14 08:23:27 2005
# Created: Fri Jan 14 08:23:27 2005
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hald_enable=yes            
dbus_enable=yes            
inetd_enable="YES"         
moused_enable="YES"        
ntpdate_enable="YES"       
gdm_enable="YES"    

 

 本文由深未来原创:http://deepfuture.iteye.com/ ,转载,请注明出处。

如果你想使用gnome的所有服务,可以使用

gnome_enable="YES"   

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
基于PyTorch的Embedding和LSTM的自动写诗实验LSTM (Long Short-Term Memory) 是一种特殊的循环神经网络(RNN)架构,用于处理具有长期依赖关系的序列数据。传统的RNN在处理长序列时往往会遇到梯度消失或梯度爆炸的问题,导致无法有效地捕捉长期依赖。LSTM通过引入门控机制(Gating Mechanism)和记忆单元(Memory Cell)来克服这些问题。 以下是LSTM的基本结构和主要组件: 记忆单元(Memory Cell):记忆单元是LSTM的核心,用于存储长期信息。它像一个传送带一样,在整个链上运行,只有一些小的线性交互。信息很容易地在其上保持不变。 输入门(Input Gate):输入门决定了哪些新的信息会被加入到记忆单元中。它由当前时刻的输入和上一时刻的隐藏状态共同决定。 遗忘门(Forget Gate):遗忘门决定了哪些信息会从记忆单元中被丢弃或遗忘。它也由当前时刻的输入和上一时刻的隐藏状态共同决定。 输出门(Output Gate):输出门决定了哪些信息会从记忆单元中输出到当前时刻的隐藏状态中。同样地,它也由当前时刻的输入和上一时刻的隐藏状态共同决定。 LSTM的计算过程可以大致描述为: 通过遗忘门决定从记忆单元中丢弃哪些信息。 通过输入门决定哪些新的信息会被加入到记忆单元中。 更新记忆单元的状态。 通过输出门决定哪些信息会从记忆单元中输出到当前时刻的隐藏状态中。 由于LSTM能够有效地处理长期依赖关系,它在许多序列建模任务中都取得了很好的效果,如语音识别、文本生成、机器翻译、时序预测等。
CSDN IT狂飙上传的代码均可运行,功能ok的情况下才上传的,直接替换数据即可使用,小白也能轻松上手 【资源说明】 基于MATLAB实现的这个代码主要是研究手写数字的识别效率,用卷积神经网络算法来实现,用的是官方手写字体数据,能够显现百分之九十以上的识别率+使用说明文档 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2020b;若运行有误,根据提示GPT修改;若不会,私信博主(问题描述要详细); 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可后台私信博主; 4.1 期刊或参考文献复现 4.2 Matlab程序定制 4.3 科研合作 功率谱估计: 故障诊断分析: 雷达通信:雷达LFM、MIMO、成像、定位、干扰、检测、信号分析、脉冲压缩 滤波估计:SOC估计 目标定位:WSN定位、滤波跟踪、目标定位 生物电信号:肌电信号EMG、脑电信号EEG、心电信号ECG 通信系统:DOA估计、编码译码、变分模态分解、管道泄漏、滤波器、数字信号处理+传输+分析+去噪、数字信号调制、误码率、信号估计、DTMF、信号检测识别融合、LEACH协议、信号检测、水声通信 5、欢迎下载,沟通交流,互相学习,共同进步!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值