Docker

FUC!

0:apt_dpkg

sudo apt --fix-broken install
apt search package_name
apt list --installed | grep qq 



sudo dpkg -r package_name
dpkg -l | grep package name
dpkg -s package_name #查看详细信息

1:docker custom path installation

sudo mkdir /etc/docker
sudo gedit /etc/docker/daemon.json
"data-root": 安装路径,自行设置
"registry-mirrors":镜像源
{   	
    "data-root": "/home/docker", 
    "registry-mirrors": [
        "https://docker.1panel.live",
        "https://6kx4zyno.mirror.aliyuncs.com",
        "https://1nj0zren.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://f1361db2.m.daocloud.io",
        "https://registry.docker-cn.com",
        "http://hub-mirror.c.163.com",
        "https://mirror.ccs.tencentyun.com/",
        "https://dockerproxy.com",
        "https://docker.nju.edu.cn",
        "https://mirror.iscas.ac.cn",
        "https://docker.mirrors.sjtug.sjtu.edu.cn",
        "https://dockerhub.azk8s.cn",
        "https://docker.m.daocloud.io"
    ]
}

# docker安装
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

sudo systemctl status docker

sudo usermod -aG docker $USER

# 加载配置
systemctl daemon-reload
#启动docker并且设置开机启动
systemctl enable docker && systemctl restart docker

docker info

2:portainer

# portainer
docker pull portainer/portainer-ce

# 启动镜像
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /dockerData/portainer:/data --restart=always --name portainer portainer/portainer-ce:latest

3:pgadmin(recommand pgadmin4-web )

#
# Setup the repository
#

# Install the public key for the repository (if not done previously):
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

# Create the repository configuration file:
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

#
# Install pgAdmin
#

# Install for both desktop and web modes:
sudo apt install pgadmin4

# Install for desktop mode only:
sudo apt install pgadmin4-desktop

# Install for web mode only:
sudo apt install pgadmin4-web

# Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh

4:docker ollama failed to pull

echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf

docker run -d --name ollama_instance \
    -v /home/lz/ollama_models_backup/models:/root/.ollama \
    -p 11434:11434 \
    ollama/ollama

docker run -d --gpus=all -v /mnt/data/ollama_data:/root/.ollama -p 11434:11434 --name ollama ollama/ollama


OLLAMA_NUM_PARALLEL - number of parallel workers to process simultaneous requests (1 by default)
OLLAMA_NUM_PARALLEL - 用于同时处理请求的并发工人数量(默认值为1)
OLLAMA_MAX_LOADED_MODELS - max number of different models which can be simultaneously loaded (1 by default)
OLLAMA_MAX_LOADED_MODELS - 允许同时加载的不同模型的最大数量(默认值为1)
OLLAMA_MAX_QUEUE - the queue length, defines number of requests that might be sitting there and waiting for being picked up (512 by default)
OLLAMA_MAX_QUEUE - 队列长度,定义了可能正在等待被处理的请求的数量(默认值为512)。
OLLAMA_MAX_VRAM - defines the max VRAM that ollama can use, if user wants to limit the usage for some reason (unlimited by default)
OLLAMA_MAX_VRAM - 定义了OLLAMA可以使用的最大VRAM大小,如果用户出于某些原因想要限制VRAM的使用(默认情况下不受限制)

5:docker compose

    
    启动服务:

        docker-compose up    #在前台启动服务

        docker-compose up -d    #启动服务在后台运行

        docker-compose up --build    #重新构建服务

    停止并移除服务、网络、卷和默认镜像:

        docker-compose down    #停止并移除服务

        docker-compose down -v    #停止服务并移除卷

    暂停服务:

        docker-compose pause

    取消暂停服务:

        docker-compose unpause

    查看服务日志:

        docker-compose logs    #查看所有服务日志

        docker-compose logs -f    #实时查看日志

    启动服务:

        docker-compose start

    停止服务:

        docker-compose stop

    重启服务:

        docker-compose restart

    查看当前服务状态:

        docker-compose ps

    进入后台运行的容器:

        docker-compose exec 容器名 /bin/sh

    拉取镜像:

        docker-compose pull

    构建镜像:

        docker-compose build

    删除或停止容器:

        docker-compose rm

    本地系统和容器之间复制文件/文件夹:

        docker-compose cp

6:llama-cpp-python

sudo apt update
sudo apt install libopenblas-dev
sudo apt install gcc-11 g++-11
sudo apt install libgomp1


locate libgomp.so.1
(litellm) lz@lz:~/PycharmProjects/ollama_test/litellm/proxy$ locate libgomp.so.1
/home/lz/anaconda3/envs/kat/lib/libgomp.so.1
/home/lz/anaconda3/envs/kat/lib/libgomp.so.1.0.0
/home/lz/anaconda3/envs/litellm/lib/libgomp.so.1
/home/lz/anaconda3/envs/litellm/lib/libgomp.so.1.0.0
/home/lz/anaconda3/envs/opc/lib/libgomp.so.1
/home/lz/anaconda3/envs/opc/lib/libgomp.so.1.0.0
/home/lz/anaconda3/lib/libgomp.so.1
/home/lz/anaconda3/lib/libgomp.so.1.0.0
/home/lz/anaconda3/pkgs/_openmp_mutex-5.1-1_gnu/lib/libgomp.so.1
/home/lz/anaconda3/pkgs/libgomp-11.2.0-h1234567_1/lib/libgomp.so.1.0.0
/snap/gnome-42-2204/176/usr/lib/x86_64-linux-gnu/libgomp.so.1
/snap/gnome-42-2204/176/usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
/usr/lib/x86_64-linux-gnu/libgomp.so.1
/usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0

(base) lz@lz:~$ ldconfig -p | grep libgomp
	libgomp.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgomp.so.1

export GGML_BLAS=ON
export GGML_BLAS_VENDOR=OpenBLAS
export LD_LIBRARY_PATH=/home/lz/anaconda3/envs/litellm/lib:$LD_LIBRARY_PATH
or export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH


CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python

7:python .whl

  • setup.py

    from setuptools import find_packages, setup
      
    setup(
        name='pycue',  # 包名称
        version='0.1.0',  # 版本号
        description='OpenCue Python bindings',  # 简短描述
        long_description=open('README.md').read(),  # 长描述,通常从 README 文件中读取
        long_description_content_type='text/markdown',  # README 文件的格式
        url='https://github.com/yourusername/OpenCue',  # 项目主页
        author='Your Name',  # 作者
        author_email='your.email@example.com',  # 作者邮箱
        license='Apache License 2.0',  # 使用的许可协议
        classifiers=[  # 分类器,帮助用户和工具了解项目
            'License :: OSI Approved :: Apache Software License',
            'Programming Language :: Python :: 3',
            'Programming Language :: Python :: 3.7',
            'Programming Language :: Python :: 3.8',
            'Programming Language :: Python :: 3.9',
        ],
        packages=find_packages(),  # 自动查找项目中的所有包
        install_requires=[  # 项目依赖
            'grpcio',
            'grpcio-tools',
            'PyYAML',
            'requests',  # 添加任何需要的依赖项
        ],
        entry_points={  # 定义可执行命令
            'console_scripts': [
                'opencue=opencue.__main__:main',  # 将 opencue 作为命令行工具
            ],
        },
        include_package_data=True,  # 包含非Python文件,如 README、LICENSE 等
        package_data={
            '': ['README.md', 'LICENSE'],  # 可以指定其他要包含的文件
            'opencue': ['*.txt', '*.yaml'],  # 如果 opencue 目录下有特定文件类型
        },
        python_requires='>=3.7',  # 支持的 Python 版本
        test_suite='tests',  # 如果有测试文件,可以在 tests/ 目录下进行测试
    )
    

python setup.py sdist bdist_wheel

pip install dist/pycue-version-py3-none-any.whl

pip install -e .