Mac自带SSH连接虚拟机(以及配置Ubuntu的一些整理)

最近连接学校提供的虚拟机,整理一些内容

连接方式:mac自带的ssh方式(命令行直接输入就可以)

ssh [email protected] -p 22

如果把服务器重装后可能会出现ECDSA host key “ip地址” for has changed and you have requested strict checking的错误

解决方法:

#xxx为我们的ip地址,清除你当前机器里关于你的远程服务器的缓存和公钥信息
ssh-keygen -R xxx
#原因:云服务器重装了系统(清除了与我本地SSH连接协议相关信息),本地的SSH协议信息便失效了

安装图形化界面

sudo apt-get install xinit
sudo apt-get install gdm #默认源可能会报错,我换成清华的源没问题了
sudo apt-get install kubuntu-desktop

更换清华源

cd /etc/apt
# 对于标准的镜像源做个备份
sudo cp sources.list sources.list.bak
# 编辑镜像源文件,将上个步骤获取到的内容替换sources.list里面原有的内容
sudo nano sources.list 
#使用gredit替代nano也可以
# 刷新镜像源
sudo apt update

替换内容网址:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 具体如下(版本需要自己选择)

Mac自带SSH连接虚拟机(以及配置Ubuntu的一些整理)_第1张图片

运行python文件的已经常用命令

#输入python可以查看是否有python环境,有没有都会提示安装
python
#输入python3可以直接进入编辑模式,exit()退出
python3
exit()
#另一方方式比较推荐,就是先创建py文件在进行保存
#创建
touch 1.py
#进行编辑
vi 1.py
#运行文件
python3 1.py

编辑文件操作

#进入编辑模型
i
#退出
:q
#保存退出文件
:wq
#强制退出
:q!

一些常用的文件操作

#创建文件
mkdir xxx
touch xxx
#进入文件
cd xxx
#删除文件
rm -f  1.py
#复制文件
cp a b
#移动文件(将a移动到b)
mv a b
#查看当前目录下的文件
ls -h

#如有需要或者具体想知道命令行参数可以自行百度 很容易搜到的

修改密码

passwd

Mac自带SSH连接虚拟机(以及配置Ubuntu的一些整理)_第2张图片

上传文件到服务器

scp /Users/ren/Downloads/Anaconda-1.4.0-Linux-x86_64.sh [email protected]:

wget方式下载

wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.07-Linux-x86_64.sh

运行安装包

#bash + 安装包名(如果不在当前目录下,就路径+安装包名)
bash Anaconda-1.4.0-Linux-x86_64.sh

例如刚刚安装anaconda过程信息


Welcome to Anaconda 1.4.0 (by Continuum Analytics, Inc.)

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> 
===================================
Anaconda END USER LICENSE AGREEMENT
===================================
Anaconda ("the Software Product") and accompanying documentation is
licensed and not sold. The Software Product is protected by copyright laws
and treaties, as well as laws and treaties related to other forms of
intellectual property. Continuum Analytics Inc or its subsidiaries,
affiliates, and suppliers (collectively "Continuum ") own intellectual
property rights in the Software Product. The Licensee's ("you" or "your")
license to download, use, copy, or change the Software Product is subject
to these rights and to all the terms and conditions of this End User
License Agreement ("Agreement").

In addition to proprietary software not available from other sources, the
Software product contains a collection of software packages from other
sources ("Other Vendor Tools").   Continuum may also distribute updates to
these packages on an "as is" basis and subject to their individual license
agreements.   These licenses are available either in the package itself or
via request to [email protected].   Continuum reserves the right to change
which Other Vendor Tools are provided in Anaconda.

Attribution License
===================
Redistribution and derivative use of Anaconda, with or without
modification, in source or binary form is explicitly permitted provided
that:

1. You include a copy of this EULA in all copies of the derived software.
2. In advertising and labeling material for products built with Anaconda
you mention that your product either includes or derives from Anaconda.
"Powered by Anaconda" is the suggested phrase.

No Implied Warranty or Fitness for Any Use
==========================================
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE

Do you approve the license terms? [yes|no]
[no] >>> yes

Anaconda will now be installed into this location:
/root/anaconda

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify an different location below

[/root/anaconda] >>> 
PREFIX=/root/anaconda
installing: python-2.7.3-7 ...
installing: _license-1.1-py27_0 ...
installing: astropy-0.2-np17py27_0 ...
installing: biopython-1.60-np17py27_0 ...
installing: bitarray-0.8.0-py27_0 ...
installing: bitey-0.0-py27_0 ...
installing: boto-2.8.0-py27_0 ...
installing: cairo-1.12.2-1 ...
installing: conda-1.4.4-py27_0 ...
installing: cubes-0.10.2-py27_0 ...
installing: cython-0.18-py27_0 ...
installing: dateutil-2.1-py27_0 ...
installing: disco-0.4.4-py27_0 ...
installing: distribute-0.6.34-py27_1 ...
installing: docutils-0.10-py27_0 ...
installing: erlang-R15B01-0 ...
installing: flask-0.9-py27_0 ...
installing: freetype-2.4.10-0 ...
installing: gdata-2.0.17-py27_0 ...
installing: gevent-0.13.8-py27_0 ...
installing: gevent-websocket-0.3.6-py27_1 ...
installing: gevent_zeromq-0.2.5-py27_1 ...
installing: googlecl-0.9.12-py27_0 ...
installing: greenlet-0.4.0-py27_0 ...
installing: grin-1.2.1-py27_1 ...
installing: h5py-2.1.1-np17py27_0 ...
installing: hdf5-1.8.9-0 ...
installing: imaging-1.1.7-py27_2 ...
installing: ipython-0.13.1-py27_1 ...
installing: jinja2-2.6-py27_0 ...
installing: jpeg-8d-0 ...
installing: libevent-2.0.20-0 ...
installing: libpng-1.5.13-1 ...
installing: libxml2-2.9.0-0 ...
installing: libxslt-1.1.28-0 ...
installing: llvm-3.2-0 ...
installing: llvmpy-0.11.1-py27_0 ...
installing: lxml-3.0.2-py27_0 ...
installing: matplotlib-1.2.0-np17py27_1 ...
installing: mdp-3.3-np17py27_0 ...
installing: meta-0.4.2.dev-py27_0 ...
installing: mpi4py-1.3-py27_0 ...
installing: mpich2-1.4.1p1-0 ...
installing: networkx-1.7-py27_0 ...
installing: nltk-2.0.4-np17py27_0 ...
installing: nose-1.2.1-py27_0 ...
installing: numba-0.7.0-np17py27_1 ...
installing: numexpr-2.0.1-np17py27_2 ...
installing: numpy-1.7.0-py27_0 ...
installing: opencv-2.4.2-np17py27_1 ...
installing: openssl-1.0.1c-0 ...
installing: pandas-0.10.1-np17py27_0 ...
installing: pip-1.2.1-py27_1 ...
installing: pixman-0.26.2-0 ...
installing: ply-3.4-py27_0 ...
installing: psutil-0.6.1-py27_0 ...
installing: py-1.4.12-py27_0 ...
installing: py2cairo-1.10.0-py27_1 ...
installing: pycparser-2.9.1-py27_0 ...
installing: pycrypto-2.6-py27_0 ...
installing: pycurl-7.19.0-py27_0 ...
installing: pyflakes-0.6.1-py27_0 ...
installing: pygments-1.6-py27_0 ...
installing: pyparsing-1.5.6-py27_0 ...
installing: pysal-1.5.0-np17py27_0 ...
installing: pysam-0.6-py27_0 ...
installing: pyside-1.1.2-py27_0 ...
installing: pytables-2.4.0-np17py27_0 ...
installing: pytest-2.3.4-py27_0 ...
installing: pytz-2012j-py27_0 ...
installing: pyyaml-3.10-py27_0 ...
installing: pyzmq-2.2.0.1-py27_0 ...
installing: qt-4.7.4-0 ...
installing: readline-6.2-0 ...
installing: redis-2.6.9-0 ...
installing: redis-py-2.7.2-py27_0 ...
installing: requests-0.13.9-py27_0 ...
installing: scikit-image-0.8.2-np17py27_0 ...
installing: scikit-learn-0.13-np17py27_1 ...
installing: scipy-0.11.0-np17py27_3 ...
installing: shiboken-1.1.2-py27_0 ...
installing: six-1.2.0-py27_0 ...
installing: sphinx-1.1.3-py27_2 ...
installing: spyder-2.1.13-py27_0 ...
installing: sqlalchemy-0.7.8-py27_0 ...
installing: sqlite-3.7.13-0 ...
installing: statsmodels-0.4.3-np17py27_0 ...
installing: sympy-0.7.1-py27_0 ...
installing: system-5.8-0 ...
installing: theano-0.5.0-np17py27_0 ...
installing: tk-8.5.13-0 ...
installing: tornado-2.4.1-py27_0 ...
installing: util-linux-2.21-0 ...
installing: werkzeug-0.8.3-py27_0 ...
installing: xlrd-0.9.0-py27_0 ...
installing: xlwt-0.7.4-py27_0 ...
installing: yaml-0.1.4-0 ...
installing: zeromq-2.2.0-0 ...
installing: zlib-1.2.7-0 ...
installing: anaconda-1.4.0-np17py27_0 ...
Python 2.7.3 :: Continuum Analytics, Inc.
creating default environment...
installation finished.

You may wish to edit your .bashrc or prepend the Anaconda install location:

$ export PATH=/root/anaconda/bin:$PATH

Thank you for installing Anaconda!

安装完后如果运行conda指令发现不存在,说明:没有将安装anaconda的路径添加到系统路径中

这个地方大家可以具体了解,这里不过多介绍了

#/root/anaconda/bin为我安装的路径,这里替换成自己的
echo 'export PATH="/root/anaconda/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

卸载、删除

#卸载xx为程序
 rm -rf xxx
#删除文件
rm xxx
#删除目录
rm -d xx

 

你可能感兴趣的:(其他,Mac)