Ubuntu的點滴-Vim、VM Tools、Samba、換源


 

 


一、虛擬機是什么?

顧名思義就是虛擬計算機,可用於安裝操作系統在里邊,相當於虛擬的一台電腦。例如安裝Linux,win10等等。

二、Ubuntu基本設置

1. 下載工具

1.1 虛擬機下載:
鏈接:https://pan.baidu.com/s/1cjBEn3C8WQyw4OcvshGwyQ
提取碼:ia2f

1.2 ubuntu鏡像文件下載:
鏈接:https://pan.baidu.com/s/1Pq08XfEjNpflme3OHrycqg
提取碼:vj6t

1)軟件開發,高版本的VMware創建的虛擬機文件用低版本的VMware是打不開的,
   兼容性可能存在問題。
(2)ubuntu的話,我個人覺得16.04版本的穩定性和兼容性好一點兒,個別安裝
   存在問題請繼續往下看
(3)我自己的話用的是15版本的VMware,16.04版本的ubuntu鏡像文件。
     配置ubuntu我就不講了,度娘一下就搜出來很多

2. 安裝 Vim

1)默認的ubuntu是沒有下載Vim,需要我們下載,否則打不開以及編輯文本
(216.04版本的ubuntu,庫的依賴版本有時候存在問題,這也是部分新手解決不
    了問題、入門困難的原因,看不懂英文以及不知道如何解決。
can@ubuntu:~$ sudo apt-get install vim
E: Unable to correct problems, you have held broken packages.

解決方案如下:

2.1  更新數據源

can@ubuntu:~$ sudo apt-get update
......

更新過程比較久,可參考后面的換源操作,提高下載速度
在重新下載vim,若還不能解決,就需要下載aptitude來進行安裝

2.2  下載aptitude

can@ubuntu:~$ sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree       
Reading state information... Done
......

下載過程也是比較久,可參考后面的換源操作,提高下載速度
can@ubuntu:~$ sudo aptitude install vim
......

通過y和n來選擇達到兼容性問題
aptitude相比apt-get在下載包的過程中,會提供解決途徑,也就是說它存在多種解決方案,
你可以通過降低包的版本來達到兼容Linux操作系統

 

三、安裝 VM Tools

VM Tools作用是可以在windows和linux操作系統之間執行復制、黏貼等操作

1. 直接安裝VM Tools

在這里插入圖片描述

2. 在我給的鏡像文件下載里邊找到 linux.iso光驅

  在虛擬機設置里邊使用虛擬光驅,然后自動加載

在這里插入圖片描述

 

此時,VM Tools的光驅就加載到虛擬機里邊
返回虛擬機界面,右擊選擇可移動設備,然后連接

 

在這里插入圖片描述


在這里插入圖片描述

步驟:
①copy安裝包到個人文件夾里邊,例如Document
②解壓安裝包
can@ubuntu:~/Documents$ tar -xvf VMwareTools-10.3.2-9925305.tar.gz 
vmware-tools-distrib/
vmware-tools-distrib/bin/
vmware-tools-distrib/bin/vm-support
vmware-tools-distrib/bin/vmware-config-tools.pl
vmware-tools-distrib/bin/vmware-uninstall-tools.pl
......
③使用超級權限執行可執行文件,然后yes
之后一直回車即可(選擇安裝目錄),等待安裝完成
can@ubuntu:~/Documents/vmware-tools-distrib$ sudo ./vmware-install.pl 
[sudo] password for can: 
The installer has detected an existing installation of open-vm-tools packages 
on this system and will not attempt to remove and replace these user-space 
applications. It is recommended to use the open-vm-tools packages provided by 
the operating system. If you do not want to use the existing installation of 
open-vm-tools packages and use VMware Tools, you must uninstall the 
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-tools
Packages must be removed with the --purge option.
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes] yes

INPUT: [yes]

Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files? 
[/usr/bin] 
.....

在這里插入圖片描述


在這里插入圖片描述

四、Samba服務器

1. 共享文件夾

步驟:
①打開虛擬機配置
②選項->共享文件夾->總是啟用->添加主機路徑->總是啟用

 

在這里插入圖片描述

2. 搭建samba服務器

CS理論:Windows作為服務端Client去訪問Linux系統中的Samba服務器
網絡連接方式請看:https://blog.csdn.net/weixin_43960484/article/details/114271855#comments_15213753

 

2.1 下載samba服務器

can@ubuntu:~$ sudo aptitude install samba
[sudo] password for can: 
The following NEW packages will be installed:
attr{a} libaio1{a} python-crypto{a} python-dnspython{a} python-ldb{a} 
python-samba{a} python-tdb{a} samba samba-common{a} samba-common-bin{a} 
samba-dsdb-modules{a} samba-vfs-modules{a} tdb-tools{a}
  ......

在這里插入圖片描述

can@ubuntu:~$ smb
smbcontrol  smbd   smbpasswd   smbstatus   smbta-util
當命令行Tab以后出現以上文件即安裝成功

2.2 備份以及配置samba文件

步驟:
(1)切換到samba工作目錄
can@ubuntu:/$ cd etc/samba/
can@ubuntu:/etc/samba$

(2)備份好配置文件
can@ubuntu:/etc/samba$ sudo cp smb.conf smb.conf.bkp
can@ubuntu:/etc/samba$ ls
gdbcommands  smb.conf  smb.conf.bkp  tls

(3)創建共享目錄(路徑)
can@ubuntu:~$ mkdir samba_share
can@ubuntu:~$ ls
Desktop    Downloads         Music     Public       samba_share_test  test
Documents  examples.desktop  Pictures  samba_share  Templates         Videos
can@ubuntu:~$ cd samba_share
can@ubuntu:~$ pwd
/home/can/samba_share

(4)修改配置文件
can@ubuntu:~$ sudo su(先進入root模式才可配置,不然文本保存不了)
root@ubuntu:/etc/samba# vim smb.conf

[share]
path = /home/can/samba_share
browseable = yes
writeable = yes
valid user = can

[Windows下訪問Samba服務器顯示目錄名稱]
共享路徑
共享目錄是否可見,yes為可見
寫權限許可,用於編輯文本
指定用戶 can 登錄才可訪問

root@ubuntu:/etc/samba# exit(退出超級權限模式)

(5)重啟服務器
can@ubuntu:~$ sudo service smbd restart

(6)win+r 找到映射網絡,**\\IP地址**實現共享
can@ubuntu:~$ ifconfig
ens33     Link encap:Ethernet  HWaddr 00:0c:29:31:82:0f  
          inet addr:192.168.88.130  Bcast:192.168.88.255  Mask:255.255.255.0
          inet6 addr: fe80::5bf9:f52d:9cf9:289/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17981 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3261 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:20513099 (20.5 MB)  TX bytes:223049 (223.0 KB)

在這里插入圖片描述

 

五、換源->提高下載速度

清華源:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
用windows瀏覽器打開,選擇對應版本的源,我的是16.04LTS

在這里插入圖片描述
步驟: (
1)切換到/etc/apt目錄,備份文件sources.list can@ubuntu:~$ cd /etc/apt/ can@ubuntu:/etc/apt$ sudo cp sources.list sources.list.bak can@ubuntu:/etc/apt$ ls apt.conf.d sources.bak sources.list.bak trusted.gpg preferences.d sources.list sources.list.d trusted.gpg.d (2)gedit打開文件,全部替換成藍色框的源,保存退出 can@ubuntu:/etc/apt$ sudo gedit sources.list (3)更新數據源 can@ubuntu:/etc/apt$ sudo apt-get update 這個等待比較久 (4)更新軟件包 can@ubuntu:/etc/apt$ sudo apt-get upgrade

在這里插入圖片描述

第二次隨筆,之所以寫這個教程,是看到網上好多奇奇怪怪的配置,
為了讓大家省點兒時間,少走彎路,記錄寫了以前的點滴。
這是我的博客,喜歡技術,喜歡頭腦風暴,歡迎交流
CSDN博客:https://blog.csdn.net/weixin_43960484
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM