linux升级py3,安装pip,svn

来源:互联网 发布:java如何utf8转换为gbk 编辑:程序博客网 时间:2024/06/06 23:32

【查看当前linux下python版本】
[root@localhost /]# python --version
Python 2.6.6

【想要查看ubuntu中安装的Python路径】

    【1.whereis python】:
    [root@localhost /]# whereis python
    python: /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
    
    【2.which python】:
    [root@localhost /]# which python
    /usr/bin/python


------------------------------------------------------------------------------------------------------------------------------------------

【Linux下python安装升级详细步骤 | Python2 升级 Python3】

    cd usr/local    #切换下载目录

    wget http://www.python.org/ftp/python/3.3.0/Python-3.3.0.tgz        #首先下载源tar包

    tar -xzvf Python-3.3.0.tgz                                            #下载完成后到下载目录下,解压

    cd Python-3.3.0                                                     #进入解压缩后的文件夹
    
    mkdir /usr/local/python3                                            #在编译前先在/usr/local建一个文件夹python3(作为python的安装路径,以免覆盖老的版本)

    ./configure --prefix=/usr/local/python3                                #配置python路径,开始编译安装

    make

    make install

    mv /usr/bin/python /usr/bin/python_old2                                #此时没有覆盖老版本,再将原来/usr/bin/python链接改为别的名字

    ln -s /usr/local/python3/bin/python3/ usr/bin/python                    #再建立新版本python的链接

    python -V        #这个时候输入

    [root@localhost Python-3.3.0]# ln -s /usr/local/python3/bin/python3 /usr/bin/python
    [root@localhost Python-3.3.0]# ls
    build         config.status  configure.ac  Include     libpython3.3m.a  Makefile         Misc     Parser   pybuilddir.txt  python         README
    config.guess  config.sub     Doc           install-sh  LICENSE          Makefile.pre     Modules  PC       pyconfig.h      Python         setup.py
    config.log    configure      Grammar       Lib         Mac              Makefile.pre.in  Objects  PCbuild  pyconfig.h.in   python-gdb.py  Tools
    [root@localhost Python-3.3.0]# python -V
    Python 3.3.0
    
    


最后扩充下,

这种方法虽然能安装成功,但是它带来了新的问题,比如yum不能正常用了

修改/usr/bin/yum的第一行为:

#!/usr/bin/python_old2

就可以了   

------------------------------------------------------------------------------------------------------------------------------------------

安装pip以及setuptools

    【安装setuptools】

            wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26

            tar -zxvf setuptools-19.6.tar.gz

            cd setuptools-19.6

            python setup.py build

            python setup.py install

    【安装pip】

            wget --no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb

            tar -zxvf pip-8.0.2.tar.gz

            cd pip-8.0.2

            python setup.py build

            python setup.py install

            python -m pip install paramiko

            python -m pip install line_profiler

------------------------------------------------------------------------------------------------------------------------------------------

安装svn服务
    (1)yum install subversion        #安装svn
    
    (2)cd /data/wwwroot            #切换目录
    
    (3)mkdir svnsata                #创建svn仓库
        [root@localhost wwwroot]# cd /data/wwwroot
        [root@localhost wwwroot]# ls
        default
        [root@localhost wwwroot]# mkdir svndata
        
    (4)svnadmin create svndata
        [root@localhost wwwroot]# ls svndata/
        conf  db  format  hooks  locks  README.txt
    
    (5)cd svn/conf
        [root@localhost svndata]# cd svn/conf
        [root@localhost conf]# ls
        authz  passwd  svnserve.conf

        authz 是权限控制文件
        passwd 是帐号密码文件
        svnserve.conf 是SVN服务配置文件
        
    (6)vi passwd     #建立了两个用户,test1,test2
        [users]
        # harry = harryssecret
        # sally = sallyssecret
        test1=123456
        test2=123456

    (7)vi authz     #编辑权限
        [/]
        liuxianan=rw
        test1=r
        test2=r
        *=

    (8)vi svnserve.conf
    
            打开下面的5个注释
            anon-access = read #匿名用户可读
            auth-access = write #授权用户可写
            password-db = passwd #使用哪个文件作为账号文件
            authz-db = authz #使用哪个文件作为权限文件
            realm = /home/svn # 认证空间名,版本库所在目录
            
            [general]
            ### These options control access to the repository for unauthenticated
            ### and authenticated users.  Valid values are "write", "read",
            ### and "none".  The sample settings below are the defaults.
            anon-access = read
            auth-access = write
            ### The password-db option controls the location of the password
            ### database file.  Unless you specify a path starting with a /,
            ### the file's location is relative to the directory containing
            ### this configuration file.
            ### If SASL is enabled (see below), this file will NOT be used.
            ### Uncomment the line below to use the default password file.
            password-db = passwd
            ### The authz-db option controls the location of the authorization
            ### rules for path-based access control.  Unless you specify a path
            ### starting with a /, the file's location is relative to the the
            ### directory containing this file.  If you don't specify an
            ### authz-db, no path-based access control is done.
            ### Uncomment the line below to use the default authorization file.
            authz-db = authz
            ### This option specifies the authentication realm of the repository.
            ### If two repositories have the same authentication realm, they should
            ### have the same password database, and vice versa.  The default realm
            ### is repository's uuid.
            #realm = My First Repository
            realm = /data/wwwroot/svndata


    (9)svnserve -d -r /data/wwwroot/svndata            #启动svn
        报错:    端口号已被占用
        [root@localhost conf]# svnserve -d -r /data/wwwroot/svndata
        svnserve: Can't bind server socket: Address already in use
        解决:
            [root@localhost conf]# netstat -antp
            Active Internet connections (servers and established)
            Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
            tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      3015/pure-ftpd      
            tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1879/sshd           
            tcp        0      0 127.0.0.1:88                0.0.0.0:*                   LISTEN      2931/httpd  
        -------------------------------------------------------------------------------------------------------------
        【  tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      27561/svnserve  】
        -------------------------------------------------------------------------------------------------------------        
            tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4589/mysqld         
            tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN      1857/memcached      
            tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      1845/redis-server 1
            tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3006/nginx          
            tcp        1      0 192.168.164.135:17100       117.103.182.194:80          CLOSE_WAIT  3538/clock-applet   
            tcp        0      0 :::21                       :::*                        LISTEN      3015/pure-ftpd      
            tcp        0      0 :::22                       :::*                        LISTEN      1879/sshd           
            tcp        0      0 ::ffff:127.0.0.1:8006       :::*                        LISTEN      3065/java           
            tcp        0      0 :::8080                     :::*                        LISTEN      3065/java  
        
        
        更换svn服务监听端口号
        svnserve -d -r /data/wwwroot/svndata --listen-port 3689
        
        仍然报错····
        kill PID
        
            [root@localhost conf]# kill 27915
            [root@localhost conf]# svnserve -d -r /data/wwwroot/svndata
            svnserve: Can't bind server socket: Address already in use
            [root@localhost conf]# netstat -antp
            Active Internet connections (servers and established)
            Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
            tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      3015/pure-ftpd      
            tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1879/sshd           
            tcp        0      0 127.0.0.1:88                0.0.0.0:*                   LISTEN      2931/httpd          
            tcp        0      0 0.0.0.0:3689                0.0.0.0:*                   LISTEN      27915/svnserve      
            tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      27561/svnserve      
            tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4589/mysqld         
            tcp        0      0 127.0.0.1:11211             0.0.0.0:*                   LISTEN      1857/memcached      
            tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      1845/redis-server 1
            tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3006/nginx          
            tcp        1      0 192.168.164.135:17100       117.103.182.194:80          CLOSE_WAIT  3538/clock-applet   
            tcp        0      0 :::21                       :::*                        LISTEN      3015/pure-ftpd      
            tcp        0      0 :::22                       :::*                        LISTEN      1879/sshd           
            tcp        0      0 ::ffff:127.0.0.1:8006       :::*                        LISTEN      3065/java           
            tcp        0      0 :::8080                     :::*                        LISTEN      3065/java           
            [root@localhost conf]# kill 27561
            [root@localhost conf]# kill 27915
            [root@localhost conf]# svnserve -d -r /data/wwwroot/svndata
            [root@localhost conf]#

        
        重新开启svn服务
            svnserve -d -r /data/wwwroot/svndata/
        
        正常
            [root@localhost conf]# cd ../
            [root@localhost svndata]# ls
            conf  db  format  hooks  locks  README.txt  test
            [root@localhost svndata]# svn list svn://127.0.0.1:3690
            testsetset.txt
            
svn list svn://192.168.164.135:3690
        
    (10)killall svnserve                            #停止svn

svn://ip/njlrxx


svn://192.168.164.135/data/wwwroot/svndata

















原创粉丝点击